From 75ddf9f09cf5c41827b1437c335e6f6bf0134111 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 29 Mar 2012 17:25:17 -0700 Subject: [PATCH 1/2] Fix issue where hotseat wasn't being correctly persisted (issue 6259158) Change-Id: Ie19c0f8e79a91a1021a3576f48e1db7d0c3478e1 --- src/com/android/launcher2/Workspace.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 0ef6fd96f6..51f092ca84 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -3349,14 +3349,22 @@ public class Workspace extends SmoothPagedView void updateItemLocationsInDatabase(CellLayout cl) { int count = cl.getShortcutsAndWidgets().getChildCount(); + int screen = indexOfChild(cl); + int container = Favorites.CONTAINER_DESKTOP; + + if (mLauncher.isHotseatLayout(cl)) { + screen = -1; + container = Favorites.CONTAINER_HOTSEAT; + } + for (int i = 0; i < count; i++) { View v = cl.getShortcutsAndWidgets().getChildAt(i); ItemInfo info = (ItemInfo) v.getTag(); // Null check required as the AllApps button doesn't have an item info if (info != null) { - LauncherModel.moveItemInDatabase(mLauncher, info, Favorites.CONTAINER_DESKTOP, - screen, info.cellX, info.cellY); + LauncherModel.moveItemInDatabase(mLauncher, info, container, screen, info.cellX, + info.cellY); } } } From 8e6c43da73e87f86bfccdb604df953746da5d61b Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 29 Mar 2012 14:30:35 -0700 Subject: [PATCH 2/2] Fixing launcher ANR (issue 6238175) Change-Id: I6518ea9e6ce8b50a5f2a3b24e909e18c5b1bde51 --- src/com/android/launcher2/CellLayout.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 5aa39c425f..199c41a59e 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -191,6 +191,8 @@ public class CellLayout extends ViewGroup { mCountY = LauncherModel.getCellCountY(); mOccupied = new boolean[mCountX][mCountY]; mTmpOccupied = new boolean[mCountX][mCountY]; + mPreviousReorderDirection[0] = INVALID_DIRECTION; + mPreviousReorderDirection[1] = INVALID_DIRECTION; a.recycle(); @@ -1566,7 +1568,8 @@ public class CellLayout extends ViewGroup { float bestDistance = Float.MAX_VALUE; // We use this to march in a single direction - if (direction[0] != 0 && direction[1] != 0) { + if ((direction[0] != 0 && direction[1] != 0) || + (direction[0] == 0 && direction[1] == 0)) { return bestXY; }