Add Interpolator for SimpleDialogCurtain
This commit is contained in:
1 parent
e6d4dc6e2e
commit
0ca00aab9b
1 file changed
+10
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user