|
@@ -20,11 +20,13 @@ import javax.annotation.Nullable;
|
20
|
20
|
|
21
|
21
|
class ScreenAnimator {
|
22
|
22
|
private final float translationY;
|
|
23
|
+ private final float translationX;
|
23
|
24
|
private Screen screen;
|
24
|
25
|
|
25
|
26
|
ScreenAnimator(Screen screen) {
|
26
|
27
|
this.screen = screen;
|
27
|
28
|
translationY = 0.08f * ViewUtils.getScreenHeight();
|
|
29
|
+ translationX = 0.08f * ViewUtils.getScreenWidth();
|
28
|
30
|
}
|
29
|
31
|
|
30
|
32
|
public void show(boolean animate, final Runnable onAnimationEnd) {
|
|
@@ -58,12 +60,30 @@ class ScreenAnimator {
|
58
|
60
|
alpha.setInterpolator(new DecelerateInterpolator());
|
59
|
61
|
alpha.setDuration(200);
|
60
|
62
|
|
61
|
|
- ObjectAnimator translationY = ObjectAnimator.ofFloat(screen, View.TRANSLATION_Y, this.translationY, 0);
|
62
|
|
- translationY.setInterpolator(new DecelerateInterpolator());
|
63
|
|
- translationY.setDuration(280);
|
64
|
|
-
|
65
|
63
|
AnimatorSet set = new AnimatorSet();
|
66
|
|
- set.playTogether(translationY, alpha);
|
|
64
|
+ switch (String.valueOf(this.screen.screenParams.animationType)) {
|
|
65
|
+ case "fade": {
|
|
66
|
+ set.play(alpha);
|
|
67
|
+ break;
|
|
68
|
+ }
|
|
69
|
+ case "slide-horizontal": {
|
|
70
|
+ ObjectAnimator translationX = ObjectAnimator.ofFloat(screen, View.TRANSLATION_X, this.translationX, 0);
|
|
71
|
+ translationX.setInterpolator(new DecelerateInterpolator());
|
|
72
|
+ translationX.setDuration(280);
|
|
73
|
+
|
|
74
|
+ set.playTogether(translationX, alpha);
|
|
75
|
+ break;
|
|
76
|
+ }
|
|
77
|
+ default: {
|
|
78
|
+ ObjectAnimator translationY = ObjectAnimator.ofFloat(screen, View.TRANSLATION_Y, this.translationY, 0);
|
|
79
|
+ translationY.setInterpolator(new DecelerateInterpolator());
|
|
80
|
+ translationY.setDuration(280);
|
|
81
|
+
|
|
82
|
+ set.playTogether(translationY, alpha);
|
|
83
|
+ break;
|
|
84
|
+ }
|
|
85
|
+ }
|
|
86
|
+
|
67
|
87
|
set.addListener(new AnimatorListenerAdapter() {
|
68
|
88
|
@Override
|
69
|
89
|
public void onAnimationStart(Animator animation) {
|
|
@@ -86,12 +106,30 @@ class ScreenAnimator {
|
86
|
106
|
alpha.setStartDelay(100);
|
87
|
107
|
alpha.setDuration(150);
|
88
|
108
|
|
89
|
|
- ObjectAnimator translationY = ObjectAnimator.ofFloat(screen, View.TRANSLATION_Y, this.translationY);
|
90
|
|
- translationY.setInterpolator(new AccelerateInterpolator());
|
91
|
|
- translationY.setDuration(250);
|
92
|
|
-
|
93
|
109
|
AnimatorSet set = new AnimatorSet();
|
94
|
|
- set.playTogether(translationY, alpha);
|
|
110
|
+ switch (String.valueOf(this.screen.screenParams.animationType)) {
|
|
111
|
+ case "fade": {
|
|
112
|
+ set.play(alpha);
|
|
113
|
+ break;
|
|
114
|
+ }
|
|
115
|
+ case "slide-horizontal": {
|
|
116
|
+ ObjectAnimator translationX = ObjectAnimator.ofFloat(screen, View.TRANSLATION_X, this.translationX);
|
|
117
|
+ translationX.setInterpolator(new AccelerateInterpolator());
|
|
118
|
+ translationX.setDuration(250);
|
|
119
|
+
|
|
120
|
+ set.playTogether(translationX, alpha);
|
|
121
|
+ break;
|
|
122
|
+ }
|
|
123
|
+ default: {
|
|
124
|
+ ObjectAnimator translationY = ObjectAnimator.ofFloat(screen, View.TRANSLATION_Y, this.translationY);
|
|
125
|
+ translationY.setInterpolator(new AccelerateInterpolator());
|
|
126
|
+ translationY.setDuration(250);
|
|
127
|
+
|
|
128
|
+ set.playTogether(translationY, alpha);
|
|
129
|
+ break;
|
|
130
|
+ }
|
|
131
|
+ }
|
|
132
|
+
|
95
|
133
|
set.addListener(new AnimatorListenerAdapter() {
|
96
|
134
|
@Override
|
97
|
135
|
public void onAnimationEnd(Animator animation) {
|