File tree Expand file tree Collapse file tree
app/src/main/java/com/gzeinnumer/mylibsearchviewdialog
java/com/gzeinnumer/mylibsearchviewdialog/dialog Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66</h1 >
77
88<div align =" center " >
9- <a><img src="https://img.shields.io/badge/Version-2.0.3 -brightgreen.svg?style=flat"></a>
9+ <a><img src="https://img.shields.io/badge/Version-2.0.4 -brightgreen.svg?style=flat"></a>
1010 <a><img src="https://img.shields.io/badge/ID-gzeinnumer-blue.svg?style=flat"></a>
1111 <a><img src="https://img.shields.io/badge/Java-Suport-green?logo=java&style=flat"></a>
1212 <a><img src="https://img.shields.io/badge/Koltin-Suport-green?logo=kotlin&style=flat"></a>
@@ -258,6 +258,19 @@ You can Customize your dialog UI. [**ReadMore**](https://github.com/gzeinnumer/M
258258
259259---
260260
261+ ### Version
262+ - ** 2.0.3**
263+ - First Release
264+ - ** 2.0.4**
265+ - Add animation and set custom animation show
266+
267+ ---
268+
269+ ### Contribution
270+ You can sent your constibution to ` branche ` ` open-pull ` .
271+
272+ ---
273+
261274```
262275Copyright 2020 M. Fadli Zein
263276```
Original file line number Diff line number Diff line change @@ -196,6 +196,36 @@ Preview :
196196 <img src =" https://github.com/gzeinnumer/MyLibDialogSearchView/blob/master/preview/MyLibDialogSearchView_21.jpg " width =" 300 " />
197197</p >
198198
199+ ##
200+
201+ ** Animation Dialog Show** You can change dialog ` animation ` .
202+
203+ ** Code** :
204+ ``` java
205+ new SearchViewDialog (getSupportFragmentManager(), list)
206+ .setAnimationStyle(R . style. CustomDialogStyle )
207+ ...
208+ .show();
209+ ```
210+ Here is the style
211+ ``` xml
212+ <resources >
213+
214+ <!-- res->styles.xml -->
215+ <style name =" CustomDialogStyle" parent =" Theme.MaterialComponents.Light.Dialog" >
216+ <item name =" android:windowMinWidthMajor" >80%</item >
217+ <item name =" android:windowMinWidthMinor" >80%</item >
218+ <item name =" android:windowEnterAnimation" >@anim/anim_in</item >
219+ <item name =" android:windowExitAnimation" >@anim/anim_out</item >
220+ </style >
221+
222+ </resources >
223+ ```
224+ Style that i prepare for you
225+ - [ anim_in] ( https://github.com/gzeinnumer/MyLibDialogFragment/blob/master/lib/src/main/res/anim/anim_in.xml ) & [ anim_out] ( https://github.com/gzeinnumer/MyLibDialogFragment/blob/master/lib/src/main/res/anim/anim_out.xml ) .
226+ - [ slide_down] ( https://github.com/gzeinnumer/MyLibDialogFragment/blob/master/lib/src/main/res/anim/slide_down.xml ) & [ slide_up] ( https://github.com/gzeinnumer/MyLibDialogFragment/blob/master/lib/src/main/res/anim/slide_up.xml ) .
227+
228+
199229##
200230
201231[ FullCode] ( https://github.com/gzeinnumer/MyLibDialogSearchView/blob/master/app/src/main/java/com/gzeinnumer/mylibsearchviewdialog/MainActivity.java ) ** Preview** :
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ private void initDialogSingleGZeinNumer2() {
338338 listObject .add (new ExampleModel (4 , "Zein4" , "Balbar4" ));
339339
340340 new SearchViewDialog <ExampleModel >(getSupportFragmentManager ())
341+ .setAnimationStyle (R .style .DialogStyle_In )
341342 .setItems (listObject )
342343 .setTitle ("ini title" )
343344 .setContent ("ini content" )
Original file line number Diff line number Diff line change @@ -27,10 +27,18 @@ public abstract class BaseDialog extends DialogFragment {
2727 protected double canvasWidth = 0.9 ;
2828 protected boolean isFullScreen = false ;
2929
30+ protected int animationStyle = R .style .DialogStyle_Slide ;
31+
32+ @ Override
33+ public void onActivityCreated (@ Nullable Bundle savedInstanceState ) {
34+ super .onActivityCreated (savedInstanceState );
35+ getDialog ().getWindow ().getAttributes ().windowAnimations = animationStyle ;
36+ }
37+
3038 @ Override
3139 public void onCreate (@ Nullable Bundle savedInstanceState ) {
3240 super .onCreate (savedInstanceState );
33- setStyle (DialogFragment .STYLE_NO_TITLE , R . style . DialogStyle );
41+ setStyle (DialogFragment .STYLE_NO_TITLE , animationStyle );
3442 }
3543
3644 @ Override
Original file line number Diff line number Diff line change 88
99import com .gzeinnumer .mylibsearchviewdialog .constant .ButtonStyle ;
1010import com .gzeinnumer .mylibsearchviewdialog .constant .SelectType ;
11+ import com .gzeinnumer .mylibsearchviewdialog .dialog .BaseDialog ;
1112
1213import java .util .ArrayList ;
1314import java .util .Arrays ;
@@ -50,6 +51,11 @@ public SearchViewDialog(FragmentManager _context) {
5051 }
5152 }
5253
54+ public SearchViewDialog setAnimationStyle (int animationStyle ) {
55+ this .animationStyle = animationStyle ;
56+ return this ;
57+ }
58+
5359 public SearchViewDialog setItems (T [] items ) {
5460 return setItems (Arrays .asList (items ));
5561 }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <set xmlns : android =" http://schemas.android.com/apk/res/android" >
3+ <scale
4+ android : interpolator =" @android:anim/linear_interpolator"
5+ android : fromXScale =" 0.0"
6+ android : toXScale =" 1.0"
7+ android : fromYScale =" 0.0"
8+ android : toYScale =" 1.0"
9+ android : fillAfter =" false"
10+ android : startOffset =" 200"
11+ android : duration =" 200"
12+ android:pivotX = " 50%"
13+ android:pivotY = " -90%"
14+ />
15+ <translate
16+ android : fromYDelta =" 50%"
17+ android : toYDelta =" 0"
18+ android : startOffset =" 200"
19+ android : duration =" 200"
20+ />
21+ </set >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <set xmlns : android =" http://schemas.android.com/apk/res/android" >
3+ <scale
4+ android : interpolator =" @android:anim/linear_interpolator"
5+ android : fromXScale =" 1.0"
6+ android : toXScale =" 0.0"
7+ android : fromYScale =" 1.0"
8+ android : toYScale =" 0.0"
9+ android : fillAfter =" false"
10+ android : duration =" 200"
11+ android:pivotX = " 50%"
12+ android:pivotY = " -90%"
13+ />
14+ <translate
15+ android : fromYDelta =" 0"
16+ android : toYDelta =" 50%"
17+ android : duration =" 200"
18+ />
19+ </set >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <set xmlns : android =" http://schemas.android.com/apk/res/android" >
3+
4+ <translate
5+ android : duration =" @android:integer/config_mediumAnimTime"
6+ android : fromYDelta =" 0%p"
7+ android : interpolator =" @android:anim/accelerate_interpolator"
8+ android : toYDelta =" 100%p" />
9+
10+ </set >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <set xmlns : android =" http://schemas.android.com/apk/res/android" >
3+
4+ <translate
5+ android : duration =" @android:integer/config_mediumAnimTime"
6+ android : fromYDelta =" 100%"
7+ android : interpolator =" @android:anim/accelerate_interpolator"
8+ android : toXDelta =" 0" />
9+
10+ </set >
Original file line number Diff line number Diff line change 1818 <item name =" android:windowMinWidthMinor" >80%</item >
1919 </style >
2020
21+ <style name =" DialogStyle_In" parent =" Theme.MaterialComponents.Light.Dialog" >
22+ <item name =" android:windowMinWidthMajor" >80%</item >
23+ <item name =" android:windowMinWidthMinor" >80%</item >
24+ <item name =" android:windowEnterAnimation" >@anim/anim_in</item >
25+ <item name =" android:windowExitAnimation" >@anim/anim_out</item >
26+ </style >
27+
28+ <style name =" DialogStyle_Slide" parent =" Theme.MaterialComponents.Light.Dialog" >
29+ <item name =" android:windowMinWidthMajor" >80%</item >
30+ <item name =" android:windowMinWidthMinor" >80%</item >
31+ <item name =" android:windowEnterAnimation" >@anim/slide_up</item >
32+ <item name =" android:windowExitAnimation" >@anim/slide_down</item >
33+ </style >
34+
2135 <style name =" MyDivider" >
2236 <item name =" android:layout_width" >match_parent</item >
2337 <item name =" android:layout_height" >1dp</item >
You can’t perform that action at this time.
0 commit comments