Don't switch pages when dragging out of folder

-> Fix bug where page switch indicator wouldn't draw on right
-> Fixed some code related to folder reordering -- no behaviour change
   yet, but once the new AutoScroll is in, this should behave correctly
   (ie. shouldn't reorder while in scroll zone)

Change-Id: Ic14a8d70858777164f094204472dc6a726dd461a
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 514dca2..94316df 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -779,7 +779,7 @@
 
         if (mInScrollArea && !LauncherAppState.getInstance().isScreenLarge()) {
             Workspace workspace = mLauncher.getWorkspace();
-            int width = workspace.getWidth();
+            int width = getMeasuredWidth();
             Rect childRect = new Rect();
             getDescendantRectRelativeToSelf(workspace.getChildAt(0), childRect);
 
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index c70cbe0..3ff4fa3 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -691,6 +691,8 @@
             } else {
                 mDragMode = DRAG_MODE_NONE;
             }
+        } else {
+            mReorderAlarm.cancelAlarm();
         }
     }
 
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 97625f5..254bf00 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3815,12 +3815,11 @@
         }
 
         boolean result = false;
-        if (!isSmall() && !mIsSwitchingState) {
+        if (!isSmall() && !mIsSwitchingState && getOpenFolder() == null) {
             mInScrollArea = true;
 
             final int page = getNextPage() +
                        (direction == DragController.SCROLL_LEFT ? -1 : 1);
-
             // We always want to exit the current layout to ensure parity of enter / exit
             setCurrentDropLayout(null);