diff options
author | Tony <twickham@google.com> | 2017-07-28 16:11:36 -0700 |
---|---|---|
committer | Tony <twickham@google.com> | 2017-07-28 18:11:06 -0700 |
commit | a8ccf0959754907de6aec63a41db5dc442047b80 (patch) | |
tree | 2e1b86b80cbd5ba3ef816207fff382289f3f1dae /src/com/android/launcher3/graphics | |
parent | 2ed276eb13f38e3383eab872b0bff26d569528c1 (diff) | |
download | android_packages_apps_Trebuchet-a8ccf0959754907de6aec63a41db5dc442047b80.tar.gz android_packages_apps_Trebuchet-a8ccf0959754907de6aec63a41db5dc442047b80.tar.bz2 android_packages_apps_Trebuchet-a8ccf0959754907de6aec63a41db5dc442047b80.zip |
Use deep shortcuts' icons as a fallback when updating
We already do this when loading, but now we also do it when
getting callbacks that potentially change the shortcut icon.
These callbacks first check the pinned shortcut info, but if
there is no icon there we now fall back to the current icon
instead of the default icon.
Bug: 62814533
Change-Id: I777adedf4b7f93dbaddb98a993eda34d59dcc173
Diffstat (limited to 'src/com/android/launcher3/graphics')
-rw-r--r-- | src/com/android/launcher3/graphics/LauncherIcons.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher3/graphics/LauncherIcons.java b/src/com/android/launcher3/graphics/LauncherIcons.java index 739eb04bd..d95567492 100644 --- a/src/com/android/launcher3/graphics/LauncherIcons.java +++ b/src/com/android/launcher3/graphics/LauncherIcons.java @@ -321,6 +321,19 @@ public class LauncherIcons { } public static Bitmap createShortcutIcon(ShortcutInfoCompat shortcutInfo, Context context, + final Bitmap fallbackIcon) { + Provider<Bitmap> fallbackIconProvider = new Provider<Bitmap>() { + @Override + public Bitmap get() { + // If the shortcut is pinned but no longer has an icon in the system, + // keep the current icon instead of reverting to the default icon. + return fallbackIcon; + } + }; + return createShortcutIcon(shortcutInfo, context, true, fallbackIconProvider); + } + + public static Bitmap createShortcutIcon(ShortcutInfoCompat shortcutInfo, Context context, boolean badged, @Nullable Provider<Bitmap> fallbackIconProvider) { LauncherAppState app = LauncherAppState.getInstance(context); Drawable unbadgedDrawable = DeepShortcutManager.getInstance(context) |