diff options
author | Winson Chung <winsonc@google.com> | 2013-07-12 14:14:16 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-07-12 15:12:32 -0700 |
commit | 156ab5b22e45b36a1c5edbe5accccf6aefcb4907 (patch) | |
tree | 258f3800bb14e891c9852e172a4ad011d15e9d68 /src/com/android/launcher3/LauncherModel.java | |
parent | 7bac576622fc56c86c8937fd425e3a510c69f375 (diff) | |
download | android_packages_apps_Trebuchet-156ab5b22e45b36a1c5edbe5accccf6aefcb4907.tar.gz android_packages_apps_Trebuchet-156ab5b22e45b36a1c5edbe5accccf6aefcb4907.tar.bz2 android_packages_apps_Trebuchet-156ab5b22e45b36a1c5edbe5accccf6aefcb4907.zip |
Fixing issue where migration all apps folder couldn't be picked up.
- Ensuring that we add items to the non-primary home page
- Fixing issue with drop-target touch handling on tablets
Change-Id: Iea5a383dc735a8f6044a00982f05789f8328ab63
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 0b69a09c9..07787cc7d 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -237,7 +237,8 @@ public class LauncherModel extends BroadcastReceiver { return CellLayout.findVacantCell(xy, 1, 1, xCount, yCount, occupied); } static Pair<Long, int[]> findNextAvailableIconSpace(Context context, String name, - Intent launchIntent) { + Intent launchIntent, + int firstScreenIndex) { // Lock on the app so that we don't try and get the items while apps are being added LauncherAppState app = LauncherAppState.getInstance(); LauncherModel model = app.getModel(); @@ -253,7 +254,9 @@ public class LauncherModel extends BroadcastReceiver { // Try adding to the workspace screens incrementally, starting at the default or center // screen and alternating between +1, -1, +2, -2, etc. (using ~ ceil(i/2f)*(-1)^(i-1)) - for (int screen = 0; screen < sBgWorkspaceScreens.size() && !found; screen++) { + firstScreenIndex = Math.min(firstScreenIndex, sBgWorkspaceScreens.size()); + int count = sBgWorkspaceScreens.size(); + for (int screen = firstScreenIndex; screen < count && !found; screen++) { int[] tmpCoordinates = new int[2]; if (findNextAvailableIconSpaceInScreen(items, tmpCoordinates, sBgWorkspaceScreens.get(screen))) { @@ -287,8 +290,9 @@ public class LauncherModel extends BroadcastReceiver { } // Add this icon to the db, creating a new page if necessary + int startSearchPageIndex = 1; Pair<Long, int[]> coords = LauncherModel.findNextAvailableIconSpace(context, - name, launchIntent); + name, launchIntent, startSearchPageIndex); if (coords == null) { // If we can't find a valid position, then just add a new screen. // This takes time so we need to re-queue the add until the new @@ -303,7 +307,7 @@ public class LauncherModel extends BroadcastReceiver { addedWorkspaceScreensFinal.add(screenId); // Find the coordinate again coords = LauncherModel.findNextAvailableIconSpace(context, - a.title.toString(), a.intent); + a.title.toString(), a.intent, startSearchPageIndex); } if (coords == null) { throw new RuntimeException("Coordinates should not be null"); |