diff options
author | Alan Viverette <alanv@google.com> | 2014-09-02 15:05:27 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-09-02 15:05:27 -0700 |
commit | be0dd99bac781d1dd73cb67f33bcd931e3693af5 (patch) | |
tree | 4ca65fbc02952fb123c40bdca131bbeeb3004055 /graphics | |
parent | 02aa75a08303796801ffd74b9c0bd2f8079248af (diff) | |
download | frameworks_base-be0dd99bac781d1dd73cb67f33bcd931e3693af5.zip frameworks_base-be0dd99bac781d1dd73cb67f33bcd931e3693af5.tar.gz frameworks_base-be0dd99bac781d1dd73cb67f33bcd931e3693af5.tar.bz2 |
Make sure ripple background bounds are used for invalidation
BUG: 17349157
Change-Id: Ie88fbabbc66349aea9b7d00e28ca12f93776a4a7
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/RippleBackground.java | 21 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/RippleDrawable.java | 10 |
2 files changed, 5 insertions, 26 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleBackground.java b/graphics/java/android/graphics/drawable/RippleBackground.java index 40a5e18..ab43e01 100644 --- a/graphics/java/android/graphics/drawable/RippleBackground.java +++ b/graphics/java/android/graphics/drawable/RippleBackground.java @@ -107,9 +107,6 @@ class RippleBackground { /** Whether we have an explicit maximum radius. */ private boolean mHasMaxRadius; - /** Whether we were canceled externally and should avoid self-removal. */ - private boolean mCanceled; - /** * Creates a new ripple. */ @@ -406,6 +403,9 @@ class RippleBackground { mHardwareAnimating = true; + // Set up the software values to match the hardware end values. + mOuterOpacity = 0; + invalidateSelf(); } @@ -414,10 +414,8 @@ class RippleBackground { * removing the ripple from the list of animating ripples. */ public void jump() { - mCanceled = true; endSoftwareAnimations(); endHardwareAnimations(); - mCanceled = false; } private void endSoftwareAnimations() { @@ -446,7 +444,6 @@ class RippleBackground { // listener on a pending animation, we also need to remove ourselves. if (!mPendingAnimations.isEmpty()) { mPendingAnimations.clear(); - removeSelf(); } mHardwareAnimating = false; @@ -526,10 +523,8 @@ class RippleBackground { * the ripple from the list of animating ripples. */ public void cancel() { - mCanceled = true; cancelSoftwareAnimations(); cancelHardwareAnimations(true); - mCanceled = false; } private void cancelSoftwareAnimations() { @@ -555,7 +550,6 @@ class RippleBackground { for (int i = 0; i < N; i++) { runningAnimations.get(i).cancel(); } - runningAnimations.clear(); if (cancelPending && !mPendingAnimations.isEmpty()) { @@ -565,13 +559,6 @@ class RippleBackground { mHardwareAnimating = false; } - private void removeSelf() { - // The owner will invalidate itself. - if (!mCanceled) { - mOwner.removeBackground(this); - } - } - private void invalidateSelf() { mOwner.invalidateSelf(); } @@ -579,7 +566,7 @@ class RippleBackground { private final AnimatorListenerAdapter mAnimationListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - removeSelf(); + mHardwareAnimating = false; } }; diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index b90fd81..e87a114 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -628,11 +628,10 @@ public class RippleDrawable extends LayerDrawable { @Override public void draw(@NonNull Canvas canvas) { - final boolean isProjected = isProjected(); final boolean hasMask = mMask != null; final boolean drawNonMaskContent = mLayerState.mNum > (hasMask ? 1 : 0); final boolean drawMask = hasMask && mMask.getOpacity() != PixelFormat.OPAQUE; - final Rect bounds = isProjected ? getDirtyBounds() : getBounds(); + final Rect bounds = getDirtyBounds(); // If we have content, draw it into a layer first. final int contentLayer = drawNonMaskContent ? @@ -685,13 +684,6 @@ public class RippleDrawable extends LayerDrawable { } } - void removeBackground(RippleBackground background) { - if (mBackground == background) { - mBackground = null; - invalidateSelf(); - } - } - private int getRippleIndex(Ripple ripple) { final Ripple[] ripples = mExitingRipples; final int count = mExitingRipplesCount; |