summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-10 21:30:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-10 21:30:27 +0000
commite2998a02696740ed179dd4726b2a331ddcfde2cc (patch)
tree8e42f54495b20ca4f1b77b9576b192eabb58b8c9
parent2964c7b8af15571e2967622eac0161c065880b3c (diff)
parent99ca2a8470a48906aaba2d76c856037933496352 (diff)
downloadframeworks_base-e2998a02696740ed179dd4726b2a331ddcfde2cc.zip
frameworks_base-e2998a02696740ed179dd4726b2a331ddcfde2cc.tar.gz
frameworks_base-e2998a02696740ed179dd4726b2a331ddcfde2cc.tar.bz2
Merge "Account for hotspot bounds in RippleDrawable projection check" into mnc-dev
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 1af48ca..134451b 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -333,17 +333,29 @@ public class RippleDrawable extends LayerDrawable {
*/
@Override
public boolean isProjected() {
- // If the maximum radius is contained entirely within the bounds, we
- // don't need to project this ripple.
+ // If the layer is bounded, then we don't need to project.
+ if (isBounded()) {
+ return false;
+ }
+
+ // Otherwise, if the maximum radius is contained entirely within the
+ // bounds then we don't need to project. This is sort of a hack to
+ // prevent check box ripples from being projected across the edges of
+ // scroll views. It does not impact rendering performance, and it can
+ // be removed once we have better handling of projection in scrollable
+ // views.
final int radius = mState.mMaxRadius;
- final Rect bounds = getBounds();
- if (radius != RADIUS_AUTO && radius <= bounds.width() / 2
- && radius <= bounds.height() / 2) {
+ final Rect drawableBounds = getBounds();
+ final Rect hotspotBounds = mHotspotBounds;
+ if (radius != RADIUS_AUTO
+ && radius <= hotspotBounds.width() / 2
+ && radius <= hotspotBounds.height() / 2
+ && (drawableBounds.equals(hotspotBounds)
+ || drawableBounds.contains(hotspotBounds))) {
return false;
}
- // Otherwise, if the layer is bounded then we don't need to project.
- return !isBounded();
+ return true;
}
private boolean isBounded() {