Add themed work badge for themed icons in dragview or floatingiconview
Bug: 288491653
Test: Verify that dragging icons with work badge have the right badge theming and that when the icons are animatng (e.g swipe to go back home from app) have the right themed/non-themed work badge
Change-Id: I3d75e83ebab0d99866f1fe3688dc06bb7e933a6e
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 709c57c..e41d8f9 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -569,12 +569,13 @@
*/
@TargetApi(Build.VERSION_CODES.TIRAMISU)
public static Drawable getFullDrawable(Context context, ItemInfo info, int width, int height,
- boolean shouldThemeIcon, Object[] outObj) {
+ boolean shouldThemeIcon, Object[] outObj, boolean[] outIsIconThemed) {
Drawable icon = loadFullDrawableWithoutTheme(context, info, width, height, outObj);
if (ATLEAST_T && icon instanceof AdaptiveIconDrawable && shouldThemeIcon) {
AdaptiveIconDrawable aid = (AdaptiveIconDrawable) icon.mutate();
Drawable mono = aid.getMonochrome();
if (mono != null && Themes.isThemedIconEnabled(context)) {
+ outIsIconThemed[0] = true;
int[] colors = ThemedIconDrawable.getColors(context);
mono = mono.mutate();
mono.setTint(colors[1]);
@@ -635,7 +636,8 @@
* badge. When dragged from workspace or folder, it may contain app AND/OR work profile badge
**/
@TargetApi(Build.VERSION_CODES.O)
- public static Drawable getBadge(Context context, ItemInfo info, Object obj) {
+ public static Drawable getBadge(Context context, ItemInfo info, Object obj,
+ boolean isIconThemed) {
LauncherAppState appState = LauncherAppState.getInstance(context);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
boolean iconBadged = (info instanceof ItemInfoWithIcon)
@@ -653,7 +655,8 @@
} else {
return Process.myUserHandle().equals(info.user)
? new ColorDrawable(Color.TRANSPARENT)
- : context.getDrawable(R.drawable.ic_work_app_badge);
+ : context.getDrawable(isIconThemed
+ ? R.drawable.ic_work_app_badge_themed : R.drawable.ic_work_app_badge);
}
}