File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
magic/src/main/java/br/com/bloder/magic/internal Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ package br .com .bloder .magic .internal ;
2
+
3
+ import android .view .View ;
4
+ import android .view .animation .Animation ;
5
+ import android .view .animation .Transformation ;
6
+
7
+ /**
8
+ * Created by bloder on 28/07/16.
9
+ */
10
+ public class Back extends Animation {
11
+
12
+ private int toWidth ;
13
+ private int startWidth ;
14
+ private View view ;
15
+
16
+ public Back (View view ) {
17
+ this .view = view ;
18
+ this .startWidth = this .view .getWidth ();
19
+ this .toWidth = view .getHeight ();
20
+ }
21
+
22
+ @ Override
23
+ protected void applyTransformation (float interpolatedTime , Transformation t ) {
24
+ final int newWidth = startWidth + (int ) ((toWidth - startWidth ) * interpolatedTime );
25
+ view .getLayoutParams ().width = newWidth ;
26
+ view .requestLayout ();
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ package br .com .bloder .magic .internal ;
2
+
3
+ import android .view .View ;
4
+ import android .view .animation .Animation ;
5
+ import android .view .animation .Transformation ;
6
+
7
+ /**
8
+ * Created by bloder on 28/07/16.
9
+ */
10
+ public class Go extends Animation {
11
+
12
+ private int toWidth ;
13
+ private int startWidth ;
14
+ private View view ;
15
+
16
+ public Go (View view ) {
17
+ this .view = view ;
18
+ this .startWidth = this .view .getWidth ();
19
+ this .toWidth = startWidth == view .getHeight () ? startWidth * 4 : view .getHeight ();
20
+ }
21
+
22
+ @ Override
23
+ protected void applyTransformation (float interpolatedTime , Transformation t ) {
24
+ final int newWidth = startWidth + (int ) ((toWidth - startWidth ) * interpolatedTime );
25
+ view .getLayoutParams ().width = newWidth ;
26
+ view .requestLayout ();
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments