diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-09-08 16:01:19 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-09-08 16:05:51 -0700 |
commit | 430c53bc80be01996b45e55687885d6c05314645 (patch) | |
tree | 6af2f75b3fb0544cb632c91d402651417fa8cd3b /src/com/android | |
parent | 5aa323f3c9cc8580335f5594ea8900fe33c00fbc (diff) | |
download | packages_apps_trebuchet-430c53bc80be01996b45e55687885d6c05314645.zip packages_apps_trebuchet-430c53bc80be01996b45e55687885d6c05314645.tar.gz packages_apps_trebuchet-430c53bc80be01996b45e55687885d6c05314645.tar.bz2 |
Fix 2981705: Unable to uninstall downloaded app by dragging to trash.
- on long press, copy constructor of ApplicationInfo is called. It wasn't copying flags.
- also fix all apps choice mode so that chosen object is set when preparing CAB
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher2/AllAppsPagedView.java | 14 | ||||
-rw-r--r-- | src/com/android/launcher2/ApplicationInfo.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/DeleteZone.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 7 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index b1275b8..1c2fa12 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -204,11 +204,6 @@ public class AllAppsPagedView extends PagedView return false; } - // start the choice mode, and select the item that was long-pressed - if (isChoiceMode(CHOICE_MODE_NONE)) { - startChoiceMode(CHOICE_MODE_SINGLE, this); - } - if (v instanceof Checkable) { // In preparation for drag, we always reset the checked grand children regardless of // what choice mode we are in @@ -219,6 +214,11 @@ public class AllAppsPagedView extends PagedView c.toggle(); } + // Start choice mode AFTER the item is selected + if (isChoiceMode(CHOICE_MODE_NONE)) { + startChoiceMode(CHOICE_MODE_SINGLE, this); + } + ApplicationInfo app = (ApplicationInfo) v.getTag(); app = new ApplicationInfo(app); @@ -399,6 +399,7 @@ public class AllAppsPagedView extends PagedView @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mode.setTitle(R.string.cab_selection_text); + menu.add(0, MENU_APP_INFO, 0, R.string.cab_menu_app_info) .setIcon(R.drawable.info_button); menu.add(0, MENU_DELETE_APP, 0, R.string.cab_menu_delete_app) @@ -423,8 +424,7 @@ public class AllAppsPagedView extends PagedView final int id = item.getItemId(); // Assumes that we are in CHOICE_MODE_SINGLE - final View chosenView = (View) getSingleCheckedGrandchild(); - final ApplicationInfo appInfo = (ApplicationInfo) chosenView.getTag(); + final ApplicationInfo appInfo = (ApplicationInfo) getChosenItem(); if (id == MENU_APP_INFO) { mLauncher.startApplicationDetailsActivity(appInfo.componentName); diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java index 6d78a44..0851cd3 100644 --- a/src/com/android/launcher2/ApplicationInfo.java +++ b/src/com/android/launcher2/ApplicationInfo.java @@ -100,6 +100,7 @@ class ApplicationInfo extends ItemInfo { componentName = info.componentName; title = info.title.toString(); intent = new Intent(info.intent); + flags = info.flags; } /** diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java index c36f701..7e4293f 100644 --- a/src/com/android/launcher2/DeleteZone.java +++ b/src/com/android/launcher2/DeleteZone.java @@ -34,7 +34,6 @@ import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.TranslateAnimation; import android.widget.ImageView; -import android.widget.Toast; public class DeleteZone extends ImageView implements DropTarget, DragController.DragListener { private static final int ORIENTATION_HORIZONTAL = 1; diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index c638119..c62c397 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -1004,9 +1004,10 @@ public abstract class PagedView extends ViewGroup { } protected void startChoiceMode(int mode, ActionMode.Callback callback) { - // StartActionMode may call through toendChoiceMode, so we should do this first - mActionMode = startActionMode(callback); - mChoiceMode = mode; + if (isChoiceMode(CHOICE_MODE_NONE)) { + mChoiceMode = mode; + mActionMode = startActionMode(callback); + } } public void endChoiceMode() { |