diff options
author | Patrick Dubroy <dubroy@google.com> | 2011-03-10 17:17:23 -0800 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2011-03-14 14:50:01 -0700 |
commit | 3499d8c89d6b5989579880bf80df31df46483304 (patch) | |
tree | 0e65923c45702c2ca00295e0a4754c1df6ec32ad /src/com/android/launcher2/BubbleTextView.java | |
parent | ec4ff67723df00e2641b5d77b486518234217c0b (diff) | |
download | android_packages_apps_Trebuchet-3499d8c89d6b5989579880bf80df31df46483304.tar.gz android_packages_apps_Trebuchet-3499d8c89d6b5989579880bf80df31df46483304.tar.bz2 android_packages_apps_Trebuchet-3499d8c89d6b5989579880bf80df31df46483304.zip |
Fix 4081795: Blue glow gone wild. DO NOT MERGE
Change-Id: I9038ed322811987e69045602f438cdf2bbd946e9
Diffstat (limited to 'src/com/android/launcher2/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher2/BubbleTextView.java | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index a8db330b3..f18a24197 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -126,23 +126,13 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca return who == mBackground || super.verifyDrawable(who); } - private void invalidatePressedOrFocusedBackground() { - int padding = HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2; - View parent = (View) getParent(); - if (parent != null) { - parent.invalidate(getLeft() - padding, getTop() - padding, - getRight() + padding, getBottom() + padding); - } - invalidate(); - } - @Override protected void drawableStateChanged() { if (isPressed()) { // In this case, we have already created the pressed outline on ACTION_DOWN, // so we just need to do an invalidate to trigger draw if (!mDidInvalidateForPressedState) { - invalidatePressedOrFocusedBackground(); + setCellLayoutPressedOrFocusedIcon(); } } else { // Otherwise, either clear the pressed/focused background, or create a background @@ -161,11 +151,11 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca mTempCanvas, mFocusedGlowColor, mFocusedOutlineColor); } mStayPressed = false; - invalidatePressedOrFocusedBackground(); + setCellLayoutPressedOrFocusedIcon(); } final boolean backgroundEmptyNow = mPressedOrFocusedBackground == null; if (!backgroundEmptyBefore && backgroundEmptyNow) { - invalidatePressedOrFocusedBackground(); + setCellLayoutPressedOrFocusedIcon(); } } @@ -196,7 +186,7 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca destCanvas.save(); destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2); destCanvas.clipRect(clipRect, Op.REPLACE); - drawImpl(destCanvas, true); + draw(destCanvas); destCanvas.restore(); } @@ -269,35 +259,25 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca if (!stayPressed) { mPressedOrFocusedBackground = null; } - invalidatePressedOrFocusedBackground(); + setCellLayoutPressedOrFocusedIcon(); } - @Override - public void draw(Canvas canvas) { - drawImpl(canvas, false); + void setCellLayoutPressedOrFocusedIcon() { + CellLayoutChildren parent = (CellLayoutChildren) getParent(); + CellLayout cellLayout = (CellLayout) parent.getParent(); + cellLayout.setPressedOrFocusedIcon((mPressedOrFocusedBackground != null) ? this : null); } - private void drawImpl(Canvas canvas, boolean preventRecursion) { - // If the View is focused but the focused background hasn't been created yet, create it now - if (!preventRecursion && isFocused() && mPressedOrFocusedBackground == null) { - mPressedOrFocusedBackground = createGlowingOutline( - mTempCanvas, mFocusedGlowColor, mFocusedOutlineColor); - } + Bitmap getPressedOrFocusedBackground() { + return mPressedOrFocusedBackground; + } - if (mPressedOrFocusedBackground != null && (isPressed() || isFocused() || mStayPressed)) { - // The blue glow can extend outside of our clip region, so we first temporarily expand - // the canvas's clip region - canvas.save(Canvas.CLIP_SAVE_FLAG); - int padding = HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2; - canvas.clipRect(-padding + mScrollX, -padding + mScrollY, - getWidth() + padding + mScrollX, getHeight() + padding + mScrollY, - Region.Op.REPLACE); - // draw blue glow - canvas.drawBitmap(mPressedOrFocusedBackground, - mScrollX - padding, mScrollY - padding, mTempPaint); - canvas.restore(); - } + int getPressedOrFocusedBackgroundPadding() { + return HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2; + } + @Override + public void draw(Canvas canvas) { final Drawable background = mBackground; if (background != null) { final int scrollX = mScrollX; |