From 179249d804e103625cd95c4265db83ab9828ad5a Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 19 Dec 2017 16:49:24 -0800 Subject: Dominant color is part of icon cache > Calculating extracted color during icon generation and storing it in model and DB > Removing unused logic avoid various types of badge rendering > Icons are badged with extracted colors, while folder is badged with theme color Bug: 35428783 Change-Id: I93e30c52fbded7515c3ae1778422e84672eafb56 --- src/com/android/launcher3/InstallShortcutReceiver.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/com/android/launcher3/InstallShortcutReceiver.java') diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index df1eec661..c47642157 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -40,6 +40,7 @@ import android.util.Pair; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.UserManagerCompat; +import com.android.launcher3.graphics.BitmapInfo; import com.android.launcher3.graphics.LauncherIcons; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.ShortcutInfoCompat; @@ -480,7 +481,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { final LauncherAppState app = LauncherAppState.getInstance(mContext); // Set default values until proper values is loaded. appInfo.title = ""; - appInfo.iconBitmap = app.getIconCache().getDefaultIcon(user); + app.getIconCache().getDefaultIcon(user).applyTo(appInfo); final ShortcutInfo si = appInfo.makeShortcut(); if (Looper.myLooper() == LauncherModel.getWorkerLooper()) { app.getIconCache().getTitleAndIcon(si, activityInfo, false /* useLowResIcon */); @@ -497,7 +498,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { return Pair.create((ItemInfo) si, (Object) activityInfo); } else if (shortcutInfo != null) { ShortcutInfo si = new ShortcutInfo(shortcutInfo, mContext); - si.iconBitmap = LauncherIcons.createShortcutIcon(shortcutInfo, mContext); + LauncherIcons.createShortcutIcon(shortcutInfo, mContext).applyTo(si); return Pair.create((ItemInfo) si, (Object) shortcutInfo); } else if (providerInfo != null) { LauncherAppWidgetProviderInfo info = LauncherAppWidgetProviderInfo @@ -641,18 +642,20 @@ public class InstallShortcutReceiver extends BroadcastReceiver { // users wouldn't get here without intent forwarding anyway. info.user = Process.myUserHandle(); + BitmapInfo iconInfo = null; if (bitmap instanceof Bitmap) { - info.iconBitmap = LauncherIcons.createIconBitmap((Bitmap) bitmap, app.getContext()); + iconInfo = LauncherIcons.createIconBitmap((Bitmap) bitmap, app.getContext()); } else { Parcelable extra = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); if (extra instanceof Intent.ShortcutIconResource) { info.iconResource = (Intent.ShortcutIconResource) extra; - info.iconBitmap = LauncherIcons.createIconBitmap(info.iconResource, app.getContext()); + iconInfo = LauncherIcons.createIconBitmap(info.iconResource, app.getContext()); } } - if (info.iconBitmap == null) { - info.iconBitmap = app.getIconCache().getDefaultIcon(info.user); + if (iconInfo == null) { + iconInfo = app.getIconCache().getDefaultIcon(info.user); } + iconInfo.applyTo(info); info.title = Utilities.trim(name); info.contentDescription = UserManagerCompat.getInstance(app.getContext()) -- cgit v1.2.3