summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-09-02 23:56:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-02 23:56:15 +0000
commit36bdc9fe9ae5b9606f79a84461397ce85291cfea (patch)
tree7c2b5414f50f54639fa0a2f6bbda70e9618670b6 /graphics
parentd780ce19201b0e0e220a3d002d903502267092c9 (diff)
parentbe0dd99bac781d1dd73cb67f33bcd931e3693af5 (diff)
downloadframeworks_base-36bdc9fe9ae5b9606f79a84461397ce85291cfea.zip
frameworks_base-36bdc9fe9ae5b9606f79a84461397ce85291cfea.tar.gz
frameworks_base-36bdc9fe9ae5b9606f79a84461397ce85291cfea.tar.bz2
Merge "Make sure ripple background bounds are used for invalidation" into lmp-dev
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/RippleBackground.java21
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java10
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;