diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-11-11 11:45:00 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-11-19 23:40:07 +0530 |
commit | 32f3dda80240e707ad4467b6b65fb589f539c58e (patch) | |
tree | 039a0b81d3aeddca2f8df76b83ed1f7d8040fccf /src/com/android/launcher3/ShortcutInfo.java | |
parent | 47a96054d97c042bd97b61795accbb9a59fd8ad0 (diff) | |
download | android_packages_apps_Trebuchet-32f3dda80240e707ad4467b6b65fb589f539c58e.tar.gz android_packages_apps_Trebuchet-32f3dda80240e707ad4467b6b65fb589f539c58e.tar.bz2 android_packages_apps_Trebuchet-32f3dda80240e707ad4467b6b65fb589f539c58e.zip |
Adding a utility class to enforce that icons are always flattened on
the background thread.
Bug: 21325319
Change-Id: I4d0f02557cdbf70cfa86750ac047faf2917e39bf
Diffstat (limited to 'src/com/android/launcher3/ShortcutInfo.java')
-rw-r--r-- | src/com/android/launcher3/ShortcutInfo.java | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java index fc087363a..f894aae0a 100644 --- a/src/com/android/launcher3/ShortcutInfo.java +++ b/src/com/android/launcher3/ShortcutInfo.java @@ -18,7 +18,6 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.content.ComponentName; -import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -33,6 +32,7 @@ import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.LauncherIcons; import com.android.launcher3.shortcuts.ShortcutInfoCompat; +import com.android.launcher3.util.ContentWriter; /** * Represents a launchable icon on the workspaces and in folders. @@ -77,12 +77,6 @@ public class ShortcutInfo extends ItemInfo { public Intent intent; /** - * Indicates whether we're using the default fallback icon instead of something from the - * app. - */ - public boolean usingFallbackIcon; - - /** * Indicates whether we're using a low res icon */ boolean usingLowResIcon; @@ -187,7 +181,6 @@ public class ShortcutInfo extends ItemInfo { status = info.status; mInstallProgress = info.mInstallProgress; isDisabled = info.isDisabled; - usingFallbackIcon = info.usingFallbackIcon; } /** TODO: Remove this. It's only called by ApplicationInfo.makeShortcut. */ @@ -240,25 +233,19 @@ public class ShortcutInfo extends ItemInfo { } @Override - void onAddToDatabase(Context context, ContentValues values) { - super.onAddToDatabase(context, values); - - String titleStr = title != null ? title.toString() : null; - values.put(LauncherSettings.BaseLauncherColumns.TITLE, titleStr); - - String uri = promisedIntent != null ? promisedIntent.toUri(0) - : (intent != null ? intent.toUri(0) : null); - values.put(LauncherSettings.BaseLauncherColumns.INTENT, uri); - values.put(LauncherSettings.Favorites.RESTORED, status); - - if (!usingFallbackIcon && !usingLowResIcon) { - writeBitmap(values, mIcon); + void onAddToDatabase(ContentWriter writer) { + super.onAddToDatabase(writer); + writer.put(LauncherSettings.BaseLauncherColumns.TITLE, title) + .put(LauncherSettings.BaseLauncherColumns.INTENT, getPromisedIntent()) + .put(LauncherSettings.Favorites.RESTORED, status); + + if (!usingLowResIcon) { + writer.putIcon(mIcon, user); } if (iconResource != null) { - values.put(LauncherSettings.BaseLauncherColumns.ICON_PACKAGE, - iconResource.packageName); - values.put(LauncherSettings.BaseLauncherColumns.ICON_RESOURCE, - iconResource.resourceName); + writer.put(LauncherSettings.BaseLauncherColumns.ICON_PACKAGE, iconResource.packageName) + .put(LauncherSettings.BaseLauncherColumns.ICON_RESOURCE, + iconResource.resourceName); } } |