Merge "Added copyright license to fade_out.xml." into ub-launcher3-master
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 58209c3..14fb3fc 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1930,7 +1930,8 @@
// 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);