Fixing a couple bugs, allapps clicks and weird crash
-> issue 5021897 (when this was fixed, exposed more bugginess that is now fixed)
-> issue 5038392
Change-Id: I49a4e9fca154f75ea22ad2c462641747536102ce
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index 5fa7be7..287a065 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -37,17 +37,19 @@
private boolean mIsDragging;
private boolean mIsDragEnabled;
private float mDragSlopeThreshold;
+ private Launcher mLauncher;
public PagedViewWithDraggableItems(Context context) {
- super(context, null);
+ this(context, null);
}
public PagedViewWithDraggableItems(Context context, AttributeSet attrs) {
- super(context, attrs, 0);
+ this(context, attrs, 0);
}
public PagedViewWithDraggableItems(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mLauncher = (Launcher) context;
}
protected boolean beginDragging(View v) {
@@ -102,10 +104,13 @@
if (!v.isInTouchMode()) return false;
// Return early if we are still animating the pages
if (mNextPage != INVALID_PAGE) return false;
+ // When we have exited all apps or are in transition, disregard long clicks
+ if (!mLauncher.isAllAppsCustomizeOpen() ||
+ mLauncher.getWorkspace().isSwitchingState()) return false;
+
return beginDragging(v);
}
-
/*
* Determines if we should change the touch state to start scrolling after the
* user moves their touch point too far.