Browse Source

Animate linear translation also when animating shared element bounds (#1100)

Animate linear translation also when animating shared element bounds
Guy Carmeli 7 years ago
parent
commit
0cf6088006

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/views/sharedElementTransition/AnimatorValuesResolver.java View File

13
 import com.reactnativenavigation.utils.ViewUtils;
13
 import com.reactnativenavigation.utils.ViewUtils;
14
 import com.reactnativenavigation.views.utils.Point;
14
 import com.reactnativenavigation.views.utils.Point;
15
 
15
 
16
-public class AnimatorValuesResolver {
16
+class AnimatorValuesResolver {
17
 
17
 
18
     final Point fromXy;
18
     final Point fromXy;
19
     final Point toXy;
19
     final Point toXy;

+ 6
- 6
android/app/src/main/java/com/reactnativenavigation/views/sharedElementTransition/SharedElementAnimatorCreator.java View File

45
         if (shouldAddCurvedMotionAnimator(resolver, params.interpolation)) {
45
         if (shouldAddCurvedMotionAnimator(resolver, params.interpolation)) {
46
             result.add(createCurvedMotionAnimator(resolver, params));
46
             result.add(createCurvedMotionAnimator(resolver, params));
47
         } else {
47
         } else {
48
-            if (shouldAddLinearMotionXAnimator(resolver, params)) {
48
+            if (shouldAddLinearMotionXAnimator(resolver)) {
49
                 result.add(createXAnimator(resolver, params));
49
                 result.add(createXAnimator(resolver, params));
50
             }
50
             }
51
-            if (shouldAddLinearMotionYAnimator(resolver, params)) {
51
+            if (shouldAddLinearMotionYAnimator(resolver)) {
52
                 result.add(createYAnimator(resolver, params));
52
                 result.add(createYAnimator(resolver, params));
53
             }
53
             }
54
         }
54
         }
76
         return resolver.startScaleX != resolver.endScaleX && !params.animateClipBounds;
76
         return resolver.startScaleX != resolver.endScaleX && !params.animateClipBounds;
77
     }
77
     }
78
 
78
 
79
-    private boolean shouldAddLinearMotionXAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
80
-        return params.animateClipBounds || resolver.dx != 0;
79
+    private boolean shouldAddLinearMotionXAnimator(AnimatorValuesResolver resolver) {
80
+        return resolver.dx != 0;
81
     }
81
     }
82
 
82
 
83
-    private boolean shouldAddLinearMotionYAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
84
-        return params.animateClipBounds || resolver.dy != 0;
83
+    private boolean shouldAddLinearMotionYAnimator(AnimatorValuesResolver resolver) {
84
+        return resolver.dy != 0;
85
     }
85
     }
86
 
86
 
87
     private boolean shouldAddCurvedMotionAnimator(AnimatorValuesResolver resolver, InterpolationParams interpolation) {
87
     private boolean shouldAddCurvedMotionAnimator(AnimatorValuesResolver resolver, InterpolationParams interpolation) {