am 3499d8c8: (-s ours) Fix 4081795: Blue glow gone wild. DO NOT MERGE
* commit '3499d8c89d6b5989579880bf80df31df46483304':
Fix 4081795: Blue glow gone wild. DO NOT MERGE
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 62bdde8..2de2efa 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -31,7 +31,7 @@
<string name="folders_tab_label" msgid="1145293785541489736">"Mapper"</string>
<string name="shortcuts_tab_label" msgid="8640731503933155644">"Flere"</string>
<string name="wallpapers_tab_label" msgid="1617804870364119879">"Tapeter"</string>
- <string name="applications_tab_label" msgid="2991364240020736760">"Programgenveje"</string>
+ <string name="applications_tab_label" msgid="2991364240020736760">"Applikationsgenvej"</string>
<string name="wallpapers_temp_tab_text" msgid="1660218201190495279">"Dette er fanen for tapeter"</string>
<string name="all_apps_tab_all" msgid="2942727589595027258">"Alle"</string>
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Programmer"</string>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 544e107..29000f6 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -34,11 +34,11 @@
<string name="applications_tab_label" msgid="2991364240020736760">"Toepassingssnelkoppelingen"</string>
<string name="wallpapers_temp_tab_text" msgid="1660218201190495279">"Dit wordt het tabblad \'Achtergronden\'"</string>
<string name="all_apps_tab_all" msgid="2942727589595027258">"Alle"</string>
- <string name="all_apps_tab_apps" msgid="5468972551904071712">"Apps"</string>
+ <string name="all_apps_tab_apps" msgid="5468972551904071712">"Toepassingen"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Games"</string>
<string name="all_apps_tab_downloaded" msgid="1488049110598641387">"Mijn apps"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Geen games gevonden."</string>
- <string name="all_apps_no_downloads" msgid="2284720393234453761">"U heeft geen gedownloade apps."</string>
+ <string name="all_apps_no_downloads" msgid="2284720393234453761">"U heeft geen gedownloade toepassingen."</string>
<!-- no translation found for market (2652226429823445833) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Kan item niet neerzetten op dit startscherm"</string>
@@ -48,7 +48,7 @@
<string name="rename_action" msgid="6016003384693240896">"OK"</string>
<string name="cancel_action" msgid="3811860427489435048">"Annuleren"</string>
<string name="menu_item_add_item" msgid="6233177331075781114">"Toevoegen aan startpagina"</string>
- <string name="group_applications" msgid="4118484163419674240">"Apps"</string>
+ <string name="group_applications" msgid="4118484163419674240">"Toepassingen"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Sneltoetsen"</string>
<string name="group_folder" msgid="5143593791798929193">"Nieuwe map"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Mappen"</string>
@@ -64,14 +64,14 @@
<string name="title_select_shortcut" msgid="2858897527672831763">"Snelkoppeling selecteren"</string>
<string name="title_select_application" msgid="8031072293115454221">"App selecteren"</string>
<string name="title_select_live_folder" msgid="3753447798805166749">"Map selecteren"</string>
- <string name="all_apps_button_label" msgid="2578400570124163469">"Apps"</string>
+ <string name="all_apps_button_label" msgid="2578400570124163469">"Toepassingen"</string>
<string name="all_apps_home_button_label" msgid="1022222300329398558">"Startpagina"</string>
<string name="delete_zone_label_workspace" msgid="7153615831493049150">"Verwijderen"</string>
<string name="delete_zone_label_all_apps" msgid="6664588234817475108">"Verwijderen"</string>
<!-- no translation found for delete_zone_label_all_apps_system_app (3683920959591819044) -->
<skip />
<string name="menu_add" msgid="3065046628354640854">"Toevoegen"</string>
- <string name="menu_manage_apps" msgid="2308685199463588895">"Apps beheren"</string>
+ <string name="menu_manage_apps" msgid="2308685199463588895">"Toepassingen beheren"</string>
<string name="menu_wallpaper" msgid="5837429080911269832">"Achtergrond"</string>
<string name="menu_search" msgid="4826514464423239041">"Zoeken"</string>
<string name="menu_notifications" msgid="6424587053194766192">"Meldingen"</string>
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index f18a241..a8db330 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -126,13 +126,23 @@
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) {
- setCellLayoutPressedOrFocusedIcon();
+ invalidatePressedOrFocusedBackground();
}
} else {
// Otherwise, either clear the pressed/focused background, or create a background
@@ -151,11 +161,11 @@
mTempCanvas, mFocusedGlowColor, mFocusedOutlineColor);
}
mStayPressed = false;
- setCellLayoutPressedOrFocusedIcon();
+ invalidatePressedOrFocusedBackground();
}
final boolean backgroundEmptyNow = mPressedOrFocusedBackground == null;
if (!backgroundEmptyBefore && backgroundEmptyNow) {
- setCellLayoutPressedOrFocusedIcon();
+ invalidatePressedOrFocusedBackground();
}
}
@@ -186,7 +196,7 @@
destCanvas.save();
destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
- draw(destCanvas);
+ drawImpl(destCanvas, true);
destCanvas.restore();
}
@@ -259,25 +269,35 @@
if (!stayPressed) {
mPressedOrFocusedBackground = null;
}
- setCellLayoutPressedOrFocusedIcon();
- }
-
- void setCellLayoutPressedOrFocusedIcon() {
- CellLayoutChildren parent = (CellLayoutChildren) getParent();
- CellLayout cellLayout = (CellLayout) parent.getParent();
- cellLayout.setPressedOrFocusedIcon((mPressedOrFocusedBackground != null) ? this : null);
- }
-
- Bitmap getPressedOrFocusedBackground() {
- return mPressedOrFocusedBackground;
- }
-
- int getPressedOrFocusedBackgroundPadding() {
- return HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2;
+ invalidatePressedOrFocusedBackground();
}
@Override
public void draw(Canvas canvas) {
+ drawImpl(canvas, false);
+ }
+
+ 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);
+ }
+
+ 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();
+ }
+
final Drawable background = mBackground;
if (background != null) {
final int scrollX = mScrollX;
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 1111c53..c1c12b5 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -113,8 +113,6 @@
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;
@@ -269,27 +267,6 @@
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);
@@ -480,19 +457,6 @@
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