summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-08-02 22:14:07 -0700
committerAdam Cohen <adamcohen@google.com>2011-08-02 22:26:50 -0700
commit9932a9b1e66fed4b5f38ce50f13d56331bbdcd7e (patch)
tree2be4b796b369af0dd4dc6770d19d299faf68a0e9 /src
parentb2cdfb5f86bcf3e97598f9dd88415980d5a51f84 (diff)
downloadandroid_packages_apps_Trebuchet-9932a9b1e66fed4b5f38ce50f13d56331bbdcd7e.tar.gz
android_packages_apps_Trebuchet-9932a9b1e66fed4b5f38ce50f13d56331bbdcd7e.tar.bz2
android_packages_apps_Trebuchet-9932a9b1e66fed4b5f38ce50f13d56331bbdcd7e.zip
Fixing weird deferred click events after deleting folder
-> Fixing issue 5055487 Change-Id: I932f95f29322fa50035b13063ab51fad2d2217e8
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/DragController.java5
-rw-r--r--src/com/android/launcher2/Launcher.java13
-rw-r--r--src/com/android/launcher2/LauncherModel.java2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 28c53d163..647a425e6 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -31,6 +31,7 @@ import android.view.ViewConfiguration;
import android.view.inputmethod.InputMethodManager;
import com.android.launcher.R;
+import com.android.launcher2.DropTarget.DragObject;
import java.util.ArrayList;
@@ -81,7 +82,7 @@ public class DragController {
*/
private int mScrollZone;
- private DropTarget.DragObject mDragObject = new DropTarget.DragObject();
+ private DropTarget.DragObject mDragObject;
/** Who can receive drop events */
private ArrayList<DropTarget> mDropTargets = new ArrayList<DropTarget>();
@@ -275,6 +276,8 @@ public class DragController {
mDragging = true;
+ mDragObject = new DropTarget.DragObject();
+
mDragObject.dragComplete = false;
mDragObject.xOffset = mMotionDownX - (dragLayerX + dragRegionLeft);
mDragObject.yOffset = mMotionDownY - (dragLayerY + dragRegionTop);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index a8782ba81..ac85f98ab 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1533,8 +1533,15 @@ public final class Launcher extends Activity
* @param v The view representing the clicked shortcut.
*/
public void onClick(View v) {
- // Make sure that rogue clicks don't get through while allapps is launching
- if (mWorkspace.isSwitchingState()) return;
+ // Make sure that rogue clicks don't get through while allapps is launching, or after the
+ // view has detached (it's possible for this to happen if the view is removed mid touch).
+ if (v.getWindowToken() == null) {
+ return;
+ }
+
+ if (mWorkspace.isSwitchingState()) {
+ return;
+ }
Object tag = v.getTag();
if (tag instanceof ShortcutInfo) {
@@ -1692,6 +1699,7 @@ public final class Launcher extends Activity
}
private void growAndFadeOutFolderIcon(FolderIcon fi) {
+ if (fi == null) return;
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.5f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.5f);
@@ -1708,6 +1716,7 @@ public final class Launcher extends Activity
}
private void shrinkAndFadeInFolderIcon(FolderIcon fi) {
+ if (fi == null) return;
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f);
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index c8cf1f832..6658f07c2 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -506,7 +506,7 @@ public class LauncherModel extends BroadcastReceiver {
sFolders.remove(info.id);
sWorkspaceItems.remove(info);
- cr.delete(LauncherSettings.Favorites.CONTENT_URI,
+ cr.delete(LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION,
LauncherSettings.Favorites.CONTAINER + "=" + info.id, null);
for (ItemInfo childInfo : info.contents) {
sItemsIdMap.remove(childInfo.id);