Make sure ripple background bounds are used for invalidation
BUG: 17349157 Change-Id: Ie88fbabbc66349aea9b7d00e28ca12f93776a4a7
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user