diff options
author | George Hilliard <gh403@msstate.edu> | 2015-01-21 11:00:24 -0600 |
---|---|---|
committer | Rohit Yengisetty <rohit@cyngn.com> | 2015-11-16 14:21:25 -0800 |
commit | 940d32f5bc51559861bf2fa080b20317b6f3a024 (patch) | |
tree | af2ef2a8e7d699384405157393a9000db40247b9 | |
parent | 6a6f1690ec0dae4c9b7fd7b5b6312698fc7a02a0 (diff) | |
download | packages_apps_PhoneCommon-940d32f5bc51559861bf2fa080b20317b6f3a024.tar.gz packages_apps_PhoneCommon-940d32f5bc51559861bf2fa080b20317b6f3a024.tar.bz2 packages_apps_PhoneCommon-940d32f5bc51559861bf2fa080b20317b6f3a024.zip |
Add AnimationCallback parameter to scaleIn() and scaleOut()
Change-Id: I32c0454d0019c52b58f0653e7b483a756ade60ca
-rw-r--r-- | src/com/android/phone/common/animation/AnimUtils.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/com/android/phone/common/animation/AnimUtils.java b/src/com/android/phone/common/animation/AnimUtils.java index 85c5a59..118a12c 100644 --- a/src/com/android/phone/common/animation/AnimUtils.java +++ b/src/com/android/phone/common/animation/AnimUtils.java @@ -122,6 +122,18 @@ public class AnimUtils { * @param startDelayMs The delay to applying the scaling in milliseconds. */ public static void scaleIn(final View view, int durationMs, int startDelayMs) { + scaleIn(view, durationMs, startDelayMs, null); + } + + /** + * Scales in the view from scale of 0 to actual dimensions. + * @param view The view to scale. + * @param durationMs The duration of the scaling in milliseconds. + * @param startDelayMs The delay to applying the scaling in milliseconds. + * @param callback The AnimationCallback to attach to the animation + */ + public static void scaleIn(final View view, int durationMs, int startDelayMs, + final AnimationCallback callback) { AnimatorListenerAdapter listener = (new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { @@ -132,6 +144,16 @@ public class AnimUtils { public void onAnimationCancel(Animator animation) { view.setScaleX(1); view.setScaleY(1); + if (callback != null) { + callback.onAnimationCancel(); + } + } + + @Override + public void onAnimationEnd(Animator animation) { + if (callback != null) { + callback.onAnimationEnd(); + } } }); scaleInternal(view, 0 /* startScaleValue */, 1 /* endScaleValue */, durationMs, @@ -143,12 +165,26 @@ public class AnimUtils { * Scales out the view from actual dimensions to 0. * @param view The view to scale. * @param durationMs The duration of the scaling in milliseconds. + * @param callback The AnimationCallback to attach */ public static void scaleOut(final View view, int durationMs) { + scaleOut(view, durationMs, null); + } + + /** + * Scales out the view from actual dimensions to 0. + * @param view The view to scale. + * @param durationMs The duration of the scaling in milliseconds. + * @param callback The AnimationCallback to attach + */ + public static void scaleOut(final View view, int durationMs, final AnimationCallback callback) { AnimatorListenerAdapter listener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); + if (callback != null) { + callback.onAnimationEnd(); + } } @Override @@ -156,6 +192,9 @@ public class AnimUtils { view.setVisibility(View.GONE); view.setScaleX(0); view.setScaleY(0); + if (callback != null) { + callback.onAnimationCancel(); + } } }; |