Merge "Modified behavior of mini-workspace screens"
diff --git a/res/drawable-xlarge-nodpi/glow_wallpaper_small.png b/res/drawable-xlarge-nodpi/glow_wallpaper_small.png
new file mode 100644
index 0000000..f83fc60
--- /dev/null
+++ b/res/drawable-xlarge-nodpi/glow_wallpaper_small.png
Binary files differ
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 22d1b63..3a47dea 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Stažené"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Nenalezeny žádné hry."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Žádné stažené aplikace."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 6806993..c898d67 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Downloadet"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Ingen spil."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Ingen hentede programmer."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index e60eb34..8ae0101 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Heruntergeladen"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Keine Spiele gefunden."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Keine heruntergeladenen Apps"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml
index 0298d91..442a5d5 100644
--- a/res/values-el/strings.xml
+++ b/res/values-el/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Η λήψη ολοκληρώθηκε"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Δεν βρέθηκαν παιχνίδια."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Δεν βρέθηκαν ληφθ. εφαρμ."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index 9158dbc..ed7a0f2 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargado"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"No se encontraron juegos."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"No se encontraron apps."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index f9d8b15..b173de0 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargadas"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"No hay juegos."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Sin aplicaciones descarg."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 5827611..0b9e816 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Téléchargées"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Aucun jeu n\'a été trouvé."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Pas d\'application téléchargée"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 5b40b98..1763f55 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Scaricate"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Nessun gioco trovato."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Nessuna appl. scaricata"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 5932429..776e8ad 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"ダウンロード済み"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"ゲームなし"</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"ダウンロードアプリなし"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 6dc4a60..d1bab2a 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"다운로드앱"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"게임이 없습니다."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"다운로드한 애플리케이션이 없습니다."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 40cbbba..e83ce45 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Nedlastet"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Finner ingen spill."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Finner ingen nedl.prog."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index fa19eea..541dbc8 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Gedownload"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Geen games gevonden."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Geen gedownl. apps gevond."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index cdfb0a9..d5c8fef 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Pobrane"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Nie znaleziono gier."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Brak pobranych aplikacji."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index 59effc7..12b65c9 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Transferidas"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Sem jogos."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Sem aplic. transferidas."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 7f947a6..fd2f12a 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Download concluído"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Nenhum jogo encontrado."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Nenhum aplic. encontrado."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-rm/strings.xml b/res/values-rm/strings.xml
index 5e7b1e7..fdbce15 100644
--- a/res/values-rm/strings.xml
+++ b/res/values-rm/strings.xml
@@ -51,7 +51,7 @@
     <skip />
     <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
     <skip />
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index acfa352..9abc657 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Загруженные"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Игр не найдено."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Нет загруженных приложений."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index 7248635..8a00147 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Hämtade"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Inga spel hittades."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"Inga hämtade appar."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index 9716ea7..2da3997 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"İndirilenler"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"Oyun bulunamadı."</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"İndirilmş uyg bulunamadı."</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 22bba84..6f1ace7 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"已下载"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"未找到游戏。"</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"未找到已下载的应用程序。"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 6cc7c32..4308584 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -39,7 +39,7 @@
     <string name="all_apps_tab_downloaded" msgid="2300935549064726963">"下載內容"</string>
     <string name="all_apps_no_games" msgid="5293893733372793696">"找不到遊戲。"</string>
     <string name="all_apps_no_downloads" msgid="6145042636084482299">"找不到已下載的應用程式。"</string>
-    <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+    <!-- no translation found for external_drop_widget_error (4976816434597126575) -->
     <skip />
     <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
     <skip />
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 272bf8b..2b566b7 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -57,6 +57,7 @@
     private static final int SCROLL_OUTSIDE_ZONE = 0;
     private static final int SCROLL_WAITING_IN_ZONE = 1;
 
+    static final int SCROLL_NONE = -1;
     static final int SCROLL_LEFT = 0;
     static final int SCROLL_RIGHT = 1;
 
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java
index 56037ff..8e729e4 100644
--- a/src/com/android/launcher2/SmoothPagedView.java
+++ b/src/com/android/launcher2/SmoothPagedView.java
@@ -131,7 +131,7 @@
         snapToPageWithVelocity(whichPage, 0, true);
     }
 
-    void snapToPageWithVelocity(int whichPage, int velocity, boolean settle) {
+    private void snapToPageWithVelocity(int whichPage, int velocity, boolean settle) {
             // if (!mScroller.isFinished()) return;
 
         whichPage = Math.max(0, Math.min(whichPage, getChildCount() - 1));
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b5b0c56..169f53f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -155,8 +155,14 @@
     private ShrinkPosition mWaitingToShrinkPosition;
     private AnimatorSet mAnimator;
 
+    /** Is the user is dragging an item near the edge of a page? */
     private boolean mInScrollArea = false;
 
+    /** If mInScrollArea is true, the direction of the scroll. */
+    private int mPendingScrollDirection = DragController.SCROLL_NONE;
+
+    private boolean mInDragMode = false;
+
     private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
     private Bitmap mDragOutline = null;
     private final Rect mTempRect = new Rect();
@@ -1423,16 +1429,32 @@
             onDropExternal(originX, originY, dragInfo, mDragTargetLayout);
         } else if (mDragInfo != null) {
             final View cell = mDragInfo.cell;
-            if (mDragTargetLayout != null) {
+            CellLayout dropTargetLayout = mDragTargetLayout;
+
+            // Handle the case where the user drops when in the scroll area.
+            // This is treated as a drop on the adjacent page.
+            if (dropTargetLayout == null && mInScrollArea) {
+                if (mPendingScrollDirection == DragController.SCROLL_LEFT) {
+                    dropTargetLayout = (CellLayout) getChildAt(mCurrentPage - 1);
+                } else if (mPendingScrollDirection == DragController.SCROLL_RIGHT) {
+                    dropTargetLayout = (CellLayout) getChildAt(mCurrentPage + 1);
+                }
+            }
+
+            if (dropTargetLayout != null) {
                 // Move internally
                 mTargetCell = findNearestVacantArea(originX, originY,
-                        mDragInfo.spanX, mDragInfo.spanY, cell, mDragTargetLayout,
+                        mDragInfo.spanX, mDragInfo.spanY, cell, dropTargetLayout,
                         mTargetCell);
 
-                if (mTargetCell == null) {
-                    snapToPage(mDragInfo.screen);
-                } else {
-                    int screen = indexOfChild(mDragTargetLayout);
+                final int screen = (mTargetCell == null) ?
+                        mDragInfo.screen : indexOfChild(dropTargetLayout);
+
+                if (screen != mCurrentPage) {
+                    snapToPage(screen);
+                }
+
+                if (mTargetCell != null) {
                     if (screen != mDragInfo.screen) {
                         // Reparent the view
                         ((CellLayout) getChildAt(mDragInfo.screen)).removeView(cell);
@@ -1443,7 +1465,7 @@
                     // update the item's position after drop
                     final ItemInfo info = (ItemInfo) cell.getTag();
                     CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
-                    mDragTargetLayout.onMove(cell, mTargetCell[0], mTargetCell[1]);
+                    dropTargetLayout.onMove(cell, mTargetCell[0], mTargetCell[1]);
                     lp.cellX = mTargetCell[0];
                     lp.cellY = mTargetCell[1];
                     cell.setId(LauncherModel.getCellLayoutChildId(-1, mDragInfo.screen,
@@ -2079,9 +2101,13 @@
     public void onEnterScrollArea(int direction) {
         if (!mIsSmall && !mIsInUnshrinkAnimation) {
             mInScrollArea = true;
-            final int screen = getCurrentPage() + ((direction == DragController.SCROLL_LEFT) ? -1 : 1);
-            if (0 <= screen && screen < getChildCount()) {
-                ((CellLayout) getChildAt(screen)).setHover(true);
+            mPendingScrollDirection = direction;
+
+            final int page = mCurrentPage + (direction == DragController.SCROLL_LEFT ? -1 : 1);
+            final CellLayout layout = (CellLayout) getChildAt(page);
+
+            if (layout != null) {
+                layout.setHover(true);
 
                 if (mDragTargetLayout != null) {
                     mDragTargetLayout.onDragExit();
@@ -2102,6 +2128,7 @@
     public void onExitScrollArea() {
         if (mInScrollArea) {
             mInScrollArea = false;
+            mPendingScrollDirection = DragController.SCROLL_NONE;
             clearAllHovers();
         }
     }