diff options
author | Alan Viverette <alanv@google.com> | 2014-12-12 22:14:20 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2014-12-12 22:14:20 +0000 |
commit | 0a69ae9666be130faedf5c8f72bea6c5f6227eaf (patch) | |
tree | 6e10b8402da3f58185611c8a0494531f0355284f /graphics | |
parent | e079f8ee2d33cfc9e320fe637a918c366eb98c85 (diff) | |
parent | 2e0e2a44073e7417a42d97e9d7b82e050a845b4d (diff) | |
download | frameworks_base-0a69ae9666be130faedf5c8f72bea6c5f6227eaf.zip frameworks_base-0a69ae9666be130faedf5c8f72bea6c5f6227eaf.tar.gz frameworks_base-0a69ae9666be130faedf5c8f72bea6c5f6227eaf.tar.bz2 |
am 1060d75e: am 9a1b4c29: Merge "Move ripple to end state on jump when hardware exit is pending" into lmp-mr1-dev
automerge: 2e0e2a4
* commit '2e0e2a44073e7417a42d97e9d7b82e050a845b4d':
Move ripple to end state on jump when hardware exit is pending
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/Ripple.java | 25 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/RippleBackground.java | 22 |
2 files changed, 37 insertions, 10 deletions
diff --git a/graphics/java/android/graphics/drawable/Ripple.java b/graphics/java/android/graphics/drawable/Ripple.java index a3a220c..ba1e86c 100644 --- a/graphics/java/android/graphics/drawable/Ripple.java +++ b/graphics/java/android/graphics/drawable/Ripple.java @@ -214,7 +214,7 @@ class Ripple { final boolean canUseHardware = c.isHardwareAccelerated(); if (mCanUseHardware != canUseHardware && mCanUseHardware) { // We've switched from hardware to non-hardware mode. Panic. - cancelHardwareAnimations(true); + cancelHardwareAnimations(false); } mCanUseHardware = canUseHardware; @@ -493,7 +493,7 @@ class Ripple { public void cancel() { mCanceled = true; cancelSoftwareAnimations(); - cancelHardwareAnimations(true); + cancelHardwareAnimations(false); mCanceled = false; } @@ -522,15 +522,30 @@ class Ripple { /** * Cancels any running hardware animations. */ - private void cancelHardwareAnimations(boolean cancelPending) { + private void cancelHardwareAnimations(boolean jumpToEnd) { final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations; final int N = runningAnimations.size(); for (int i = 0; i < N; i++) { - runningAnimations.get(i).cancel(); + if (jumpToEnd) { + runningAnimations.get(i).end(); + } else { + runningAnimations.get(i).cancel(); + } } runningAnimations.clear(); - mHasPendingHardwareExit = false; + if (mHasPendingHardwareExit) { + // If we had a pending hardware exit, jump to the end state. + mHasPendingHardwareExit = false; + + if (jumpToEnd) { + mOpacity = 0; + mTweenX = 1; + mTweenY = 1; + mTweenRadius = 1; + } + } + mHardwareAnimating = false; } diff --git a/graphics/java/android/graphics/drawable/RippleBackground.java b/graphics/java/android/graphics/drawable/RippleBackground.java index 665d736..cc42aac 100644 --- a/graphics/java/android/graphics/drawable/RippleBackground.java +++ b/graphics/java/android/graphics/drawable/RippleBackground.java @@ -148,7 +148,7 @@ class RippleBackground { final boolean canUseHardware = c.isHardwareAccelerated(); if (mCanUseHardware != canUseHardware && mCanUseHardware) { // We've switched from hardware to non-hardware mode. Panic. - cancelHardwareAnimations(true); + cancelHardwareAnimations(false); } mCanUseHardware = canUseHardware; @@ -399,7 +399,7 @@ class RippleBackground { */ public void cancel() { cancelSoftwareAnimations(); - cancelHardwareAnimations(true); + cancelHardwareAnimations(false); } private void cancelSoftwareAnimations() { @@ -412,15 +412,27 @@ class RippleBackground { /** * Cancels any running hardware animations. */ - private void cancelHardwareAnimations(boolean cancelPending) { + private void cancelHardwareAnimations(boolean jumpToEnd) { final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations; final int N = runningAnimations.size(); for (int i = 0; i < N; i++) { - runningAnimations.get(i).cancel(); + if (jumpToEnd) { + runningAnimations.get(i).end(); + } else { + runningAnimations.get(i).cancel(); + } } runningAnimations.clear(); - mHasPendingHardwareExit = false; + if (mHasPendingHardwareExit) { + // If we had a pending hardware exit, jump to the end state. + mHasPendingHardwareExit = false; + + if (jumpToEnd) { + mOuterOpacity = 0; + } + } + mHardwareAnimating = false; } |