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
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 @@
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 @@
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 @@
@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 @@
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 @@
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.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 @@
}
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() {