diff options
-rw-r--r-- | res/layout-xlarge-land/all_apps_tabbed.xml | 1 | ||||
-rw-r--r-- | res/layout-xlarge-port/all_apps_tabbed.xml | 1 | ||||
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/AllApps2D.java | 14 | ||||
-rw-r--r-- | src/com/android/launcher2/AllAppsPagedView.java | 24 | ||||
-rw-r--r-- | src/com/android/launcher2/ApplicationInfo.java | 19 | ||||
-rw-r--r-- | src/com/android/launcher2/BubbleTextView.java | 3 |
7 files changed, 31 insertions, 35 deletions
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml index d03a57158..850a3c352 100644 --- a/res/layout-xlarge-land/all_apps_tabbed.xml +++ b/res/layout-xlarge-land/all_apps_tabbed.xml @@ -53,7 +53,6 @@ </FrameLayout> <com.android.launcher2.DeleteZone android:id="@+id/all_apps_delete_zone" - android:text="@string/delete_zone_label_all_apps" android:drawablePadding="@dimen/delete_zone_drawable_padding" android:drawableLeft="@drawable/delete_zone_selector" android:layout_width="wrap_content" diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml index 269fa1275..f38caf680 100644 --- a/res/layout-xlarge-port/all_apps_tabbed.xml +++ b/res/layout-xlarge-port/all_apps_tabbed.xml @@ -53,7 +53,6 @@ </FrameLayout> <com.android.launcher2.DeleteZone android:id="@+id/all_apps_delete_zone" - android:text="@string/delete_zone_label_all_apps" android:drawablePadding="@dimen/delete_zone_drawable_padding" android:drawableLeft="@drawable/delete_zone_selector" android:layout_width="wrap_content" diff --git a/res/values/strings.xml b/res/values/strings.xml index 6dcaa5748..389fcca38 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -149,6 +149,10 @@ device. [CHAR_LIMIT=30]--> <string name="delete_zone_label_all_apps">Uninstall</string> + <!-- Label for trash icon in All Apps, when an updated system app is selected. The update will + be uninstalled. [CHAR_LIMIT=30] --> + <string name="delete_zone_label_all_apps_system_app">Uninstall update</string> + <!-- Menus items: --> <skip /> <!-- Verb, menu item used to add an item on the desktop --> diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java index a9423be1f..1cbb99994 100644 --- a/src/com/android/launcher2/AllApps2D.java +++ b/src/com/android/launcher2/AllApps2D.java @@ -313,19 +313,9 @@ public class AllApps2D mVisibleAppsList.clear(); if (appType == AppType.ALL) { mVisibleAppsList.addAll(mAllAppsList); - } else { - int searchFlags = 0; - - if (appType == AppType.APP) { - searchFlags = ApplicationInfo.APP_FLAG; - } else if (appType == AppType.GAME) { - searchFlags = ApplicationInfo.GAME_FLAG; - } else if (appType == AppType.DOWNLOADED) { - searchFlags = ApplicationInfo.DOWNLOADED_FLAG; - } - + } else if (appType == AppType.DOWNLOADED) { for (ApplicationInfo info : mAllAppsList) { - if ((info.flags & searchFlags) != 0) { + if ((info.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) { mVisibleAppsList.add(info); } } diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index bfe6ec171..4158b4ad2 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -203,11 +203,21 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All } } - private void setupDragMode() { + private void setupDragMode(ApplicationInfo info) { mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE); - DeleteZone allAppsDeleteZone = (DeleteZone) - mLauncher.findViewById(R.id.all_apps_delete_zone); - allAppsDeleteZone.setDragAndDropEnabled(true); + + // Only show the uninstall button if the app is uninstallable. + if ((info.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) { + DeleteZone allAppsDeleteZone = (DeleteZone) + mLauncher.findViewById(R.id.all_apps_delete_zone); + allAppsDeleteZone.setDragAndDropEnabled(true); + + if ((info.flags & ApplicationInfo.UPDATED_SYSTEM_APP_FLAG) != 0) { + allAppsDeleteZone.setText(R.string.delete_zone_label_all_apps_system_app); + } else { + allAppsDeleteZone.setText(R.string.delete_zone_label_all_apps); + } + } ApplicationInfoDropTarget allAppsInfoButton = (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target); @@ -240,12 +250,12 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All if (!v.isInTouchMode()) return false; if (!super.beginDragging(v)) return false; - // Start drag mode after the item is selected - setupDragMode(); - ApplicationInfo app = (ApplicationInfo) v.getTag(); app = new ApplicationInfo(app); + // Start drag mode after the item is selected + setupDragMode(app); + // get icon (top compound drawable, index is 1) final TextView tv = (TextView) v; final Drawable icon = tv.getCompoundDrawables()[1]; diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java index 3adea373e..1d948b738 100644 --- a/src/com/android/launcher2/ApplicationInfo.java +++ b/src/com/android/launcher2/ApplicationInfo.java @@ -59,9 +59,9 @@ class ApplicationInfo extends ItemInfo { ComponentName componentName; - static final int APP_FLAG = 1; - static final int GAME_FLAG = 2; - static final int DOWNLOADED_FLAG = 4; + static final int DOWNLOADED_FLAG = 1; + static final int UPDATED_SYSTEM_APP_FLAG = 2; + int flags = 0; ApplicationInfo() { @@ -83,17 +83,12 @@ class ApplicationInfo extends ItemInfo { int appFlags = pm.getApplicationInfo(packageName, 0).flags; if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) { flags |= DOWNLOADED_FLAG; - } - if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { - flags |= DOWNLOADED_FLAG; - } - firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime; - // TODO: Figure out how to determine what is a game - // If it's not a game, it's an app - if ((flags & GAME_FLAG) == 0) { - flags |= APP_FLAG; + if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { + flags |= UPDATED_SYSTEM_APP_FLAG; + } } + firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime; } catch (NameNotFoundException e) { Log.d(TAG, "PackageManager.getApplicationInfo failed for " + packageName); } diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index 203883eb5..f708e2fda 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -171,9 +171,8 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca } /** - * Draw the View v into the given Canvas. + * Draw this BubbleTextView into the given Canvas. * - * @param v the view to draw * @param destCanvas the canvas to draw on * @param padding the horizontal and vertical padding to use when drawing */ |