Updating icon badging logic
Bug: 201682172
Test: Manual
Change-Id: I57421b0c77e12f1cd464e532d2a1383c2cf93981
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 5a6365a..4ee192a 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -18,6 +18,8 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_ICON_LABEL_AUTO_SCALING;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
+import static com.android.launcher3.icons.BitmapInfo.FLAG_NO_BADGE;
+import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import android.animation.Animator;
@@ -145,6 +147,8 @@
private final int mIconSize;
@ViewDebug.ExportedProperty(category = "launcher")
+ private boolean mHideBadge = false;
+ @ViewDebug.ExportedProperty(category = "launcher")
private boolean mIsIconVisible = true;
@ViewDebug.ExportedProperty(category = "launcher")
private int mTextColor;
@@ -241,6 +245,10 @@
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
+ public void setHideBadge(boolean hideBadge) {
+ mHideBadge = hideBadge;
+ }
+
/**
* Resets the view so it can be recycled.
*/
@@ -364,7 +372,11 @@
protected void applyIconAndLabel(ItemInfoWithIcon info) {
boolean useTheme = mDisplay == DISPLAY_WORKSPACE || mDisplay == DISPLAY_FOLDER
|| mDisplay == DISPLAY_TASKBAR;
- FastBitmapDrawable iconDrawable = info.newIcon(getContext(), useTheme);
+ int flags = useTheme ? FLAG_THEMED : 0;
+ if (mHideBadge) {
+ flags |= FLAG_NO_BADGE;
+ }
+ FastBitmapDrawable iconDrawable = info.newIcon(getContext(), flags);
mDotParams.color = IconPalette.getMutedColor(iconDrawable.getIconColor(), 0.54f);
setIcon(iconDrawable);