Fix 4081795: Blue glow gone wild. DO NOT MERGE
Change-Id: I9038ed322811987e69045602f438cdf2bbd946e9
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index c1c12b5..1111c53 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -113,6 +113,8 @@
private int mDragOutlineCurrent = 0;
private final Paint mDragOutlinePaint = new Paint();
+ private BubbleTextView mPressedOrFocusedIcon;
+
private Drawable mCrosshairsDrawable = null;
private InterruptibleInOutAnimator mCrosshairsAnimator = null;
private float mCrosshairsVisibility = 0.0f;
@@ -267,6 +269,27 @@
addView(mChildren);
}
+ private void invalidateBubbleTextView(BubbleTextView icon) {
+ final int padding = icon.getPressedOrFocusedBackgroundPadding();
+ invalidate(icon.getLeft() - padding,
+ icon.getTop() - padding,
+ icon.getRight() + padding,
+ icon.getBottom() + padding);
+ }
+
+ void setPressedOrFocusedIcon(BubbleTextView icon) {
+ // We draw the pressed or focused BubbleTextView's background in CellLayout because it
+ // requires an expanded clip rect (due to the glow's blur radius)
+ BubbleTextView oldIcon = mPressedOrFocusedIcon;
+ mPressedOrFocusedIcon = icon;
+ if (oldIcon != null) {
+ invalidateBubbleTextView(oldIcon);
+ }
+ if (mPressedOrFocusedIcon != null) {
+ invalidateBubbleTextView(mPressedOrFocusedIcon);
+ }
+ }
+
public CellLayoutChildren getChildrenLayout() {
if (getChildCount() > 0) {
return (CellLayoutChildren) getChildAt(0);
@@ -457,6 +480,19 @@
canvas.drawBitmap(b, p.x, p.y, paint);
}
}
+
+ // We draw the pressed or focused BubbleTextView's background in CellLayout because it
+ // requires an expanded clip rect (due to the glow's blur radius)
+ if (mPressedOrFocusedIcon != null) {
+ final int padding = mPressedOrFocusedIcon.getPressedOrFocusedBackgroundPadding();
+ final Bitmap b = mPressedOrFocusedIcon.getPressedOrFocusedBackground();
+ if (b != null) {
+ canvas.drawBitmap(b,
+ mPressedOrFocusedIcon.getLeft() - padding,
+ mPressedOrFocusedIcon.getTop() - padding,
+ null);
+ }
+ }
}
@Override