Fix 3385675: Uninstall option available for system app

- when a system app is selected in all apps, don't show uninstall button
- if it's an updated system app, show "Uninstall update"
- Also, remove unused code for non-existent flag for games

Change-Id: I46753ee8d213b2ba1613b71ac1fe73d79786129c
This commit is contained in:
Patrick Dubroy
2011-02-28 15:16:42 -08:00
parent 60b753b4cf
commit cd953711fc
7 changed files with 31 additions and 35 deletions
@@ -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];