diff options
author | d34d <clark@cyngn.com> | 2015-07-17 10:06:20 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-07-22 11:58:04 -0700 |
commit | 53b6e9dd1a97ea59a84e4c8b7172e1773d990ee5 (patch) | |
tree | d8c46c3d286fe94c593fb5c1542aee0505dd1094 /src/com/android/launcher3/Launcher.java | |
parent | c7b06ddeaed7dbaf25fd87dedbd4f6921e72cfca (diff) | |
download | android_packages_apps_Trebuchet-53b6e9dd1a97ea59a84e4c8b7172e1773d990ee5.tar.gz android_packages_apps_Trebuchet-53b6e9dd1a97ea59a84e4c8b7172e1773d990ee5.tar.bz2 android_packages_apps_Trebuchet-53b6e9dd1a97ea59a84e4c8b7172e1773d990ee5.zip |
Show apps as unavailable when on unmounted storage
This patch allows shortcuts to apps that are currently unavailable
due to being on unmounted external storage to remain on the workspace
and in folders. The icons will be disabled and grayed out until
the external storage is mounted.
Change-Id: I971483806b27e3a75ef0d5bb89d8dfb86f97511e
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 5ae3a30d7..84e29b565 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3080,11 +3080,15 @@ public class Launcher extends Activity final Intent intent; if (tag instanceof ShortcutInfo) { shortcut = (ShortcutInfo) tag; + if (shortcut.isDisabled) { + Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_SHORT).show(); + return; + } intent = shortcut.intent; int[] pos = new int[2]; v.getLocationOnScreen(pos); - intent.setSourceBounds(new Rect(pos[0], pos[1], - pos[0] + v.getWidth(), pos[1] + v.getHeight())); + intent.setSourceBounds( + new Rect(pos[0], pos[1], pos[0] + v.getWidth(), pos[1] + v.getHeight())); } else if (tag instanceof AppInfo) { shortcut = null; @@ -5537,6 +5541,38 @@ public class Launcher extends Activity } /** + * A package has become unavailable. + * + * Implementation of the method from LauncherModel.Callbacks. + */ + public void bindComponentsUnavailable(final ArrayList<String> packageNames, + final ArrayList<AppInfo> appInfos) { + if (!packageNames.isEmpty()) { + mWorkspace.updateUnavailableItemsByPackageName(packageNames); + } + // Notify the drag controller + mDragController.onAppsRemoved(packageNames, appInfos); + + // Update AllApps + if (!LauncherAppState.isDisableAllApps() && + mAppsCustomizeContent != null) { + mAppsCustomizeContent.removeApps(appInfos); + mAppDrawerAdapter.removeApps(appInfos); + } + } + + /** + * A package has become unavailable. + * + * Implementation of the method from LauncherModel.Callbacks. + */ + public void bindComponentsAvailable(final ArrayList<ItemInfo> itemInfos) { + if (!itemInfos.isEmpty()) { + mWorkspace.updateAvailableItems(itemInfos); + } + } + + /** * A number of packages were updated. */ private ArrayList<Object> mWidgetsAndShortcuts; |