From 4cab3b550b3c296cd120bdf23f524f34b155dca5 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 10 Sep 2015 09:12:12 -0700 Subject: [PATCH] Find page for widget starting at current page from overview. Previously the search began with the page that the user long-pressed to enter the overview, even if they then free- scrolled to another page before selecting "Widgets." Change-Id: Ie286f6864c78b573c05dd9d02c1346e17db711a6 --- src/com/android/launcher3/Workspace.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 58209c3176..14fb3fc59c 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1930,7 +1930,8 @@ public class Workspace extends PagedView // Find a page that has enough space to place this widget (after rearranging/resizing). // Start at the current page and search right (on LTR) until finding a page with enough // space. Since an empty screen is the furthest right, a page must be found. - for (int pageIndex = getCurrentPage(); pageIndex <= getPageCount(); pageIndex++) { + int currentPageInOverview = getPageNearestToCenterOfScreen(); + for (int pageIndex = currentPageInOverview; pageIndex < getPageCount(); pageIndex++) { CellLayout page = (CellLayout) getPageAt(pageIndex); if (page.hasReorderSolution(info)) { setCurrentPage(pageIndex);