From 0ca00aab9bef2a4d1c597f9064ddb4e2d6e79aa6 Mon Sep 17 00:00:00 2001 From: seven332 Date: Fri, 1 May 2015 02:09:13 +0800 Subject: [PATCH] Add Interpolator for SimpleDialogCurtain --- .../main/java/com/hippo/scene/SimpleDialogCurtain.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/hippo/scene/SimpleDialogCurtain.java b/app/src/main/java/com/hippo/scene/SimpleDialogCurtain.java index 445b5d3f6..8b91fc340 100644 --- a/app/src/main/java/com/hippo/scene/SimpleDialogCurtain.java +++ b/app/src/main/java/com/hippo/scene/SimpleDialogCurtain.java @@ -20,8 +20,11 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.support.annotation.NonNull; +import android.support.v4.view.animation.FastOutLinearInInterpolator; +import android.support.v4.view.animation.LinearOutSlowInInterpolator; import android.view.View; import android.view.ViewTreeObserver; +import android.view.animation.Interpolator; import com.hippo.animation.ArgbEvaluator; import com.hippo.animation.SimpleAnimatorListener; @@ -35,6 +38,9 @@ public class SimpleDialogCurtain extends Curtain { private static long ANIMATE_TIME = 300L; + private final static Interpolator FAST_OUT_LINEAR_IN_INTERPOLATOR = new FastOutLinearInInterpolator(); + private final static Interpolator LINEAR_OUT_SLOW_IN_INTERPOLATOR = new LinearOutSlowInInterpolator(); + private int mStartX; private int mStartY; @@ -63,6 +69,7 @@ public class SimpleDialogCurtain extends Curtain { ObjectAnimator colorAnim = ObjectAnimator.ofInt(enter, "backgroundColor", bgColor); colorAnim.setEvaluator(ArgbEvaluator.getInstance()); colorAnim.setDuration(ANIMATE_TIME); + colorAnim.setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR); animatorCollection.add(colorAnim); final View mFrame = enterDialog.getFrame(); @@ -104,6 +111,7 @@ public class SimpleDialogCurtain extends Curtain { PropertyValuesHolder bottomPvh = PropertyValuesHolder.ofInt("drawBottom", startBottom, endBottom); ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(mFrame, leftPvh, topPvh, rightPvh, bottomPvh); anim.setDuration(ANIMATE_TIME); + anim.setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR); animatorCollection.add(anim); @@ -139,6 +147,7 @@ public class SimpleDialogCurtain extends Curtain { colorAnim.setEvaluator(ArgbEvaluator.getInstance()); colorAnim.setDuration(ANIMATE_TIME); animatorCollection.add(colorAnim); + colorAnim.setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR); final View mFrame = exitDialog.getFrame(); AssertUtils.assertNotNull("Frame view must not be null.", mFrame); @@ -171,6 +180,7 @@ public class SimpleDialogCurtain extends Curtain { PropertyValuesHolder bottomPvh = PropertyValuesHolder.ofInt("drawBottom", startBottom, endBottom); ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(mFrame, leftPvh, topPvh, rightPvh, bottomPvh); anim.setDuration(ANIMATE_TIME); + anim.setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR); animatorCollection.add(anim);