From 8741298d3c6a17015dabc4aacc261fd8eb59992d Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 3 Oct 2013 18:34:14 -0700 Subject: [PATCH] Fixing issue with numerous empty screens showing when adding a shortcut to a clear workspace. (Bug 10785413) Change-Id: Ib9b5f76dc23e609b1774147a6cf760f185d9154b --- src/com/android/launcher3/Launcher.java | 3 +++ src/com/android/launcher3/LauncherModel.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index f3a02b3c2f..e3e065e03c 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3664,6 +3664,9 @@ public class Launcher extends Activity addAnimated.size(), true); } + // Remove the extra empty screen + mWorkspace.removeExtraEmptyScreen(); + if (!AppsCustomizePagedView.DISABLE_ALL_APPS && addedApps != null && mAppsCustomizeContent != null) { mAppsCustomizeContent.addApps(addedApps); diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index edfc07059d..d1819e14d8 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -318,8 +318,10 @@ public class LauncherModel extends BroadcastReceiver { continue; } - // Add this icon to the db, creating a new page if necessary - int startSearchPageIndex = 1; + // Add this icon to the db, creating a new page if necessary. If there + // is only the empty page then we just add items to the first page. + // Otherwise, we add them to the next pages. + int startSearchPageIndex = workspaceScreens.isEmpty() ? 0 : 1; Pair coords = LauncherModel.findNextAvailableIconSpace(context, name, launchIntent, startSearchPageIndex, workspaceScreens); if (coords == null) {