diff options
author | Tony Wickham <twickham@google.com> | 2015-11-04 17:44:32 -0800 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2015-11-04 17:44:32 -0800 |
commit | 25189851ace521c856faf7a9deacf1330b5bef92 (patch) | |
tree | 474559ae5089f04bfe1284afc6ba72e34d20a568 /src/com/android/launcher3/FocusHelper.java | |
parent | 04e2c9ef5663262fc9dd08ffc4b59fe305a017f3 (diff) | |
download | android_packages_apps_Trebuchet-25189851ace521c856faf7a9deacf1330b5bef92.tar.gz android_packages_apps_Trebuchet-25189851ace521c856faf7a9deacf1330b5bef92.tar.bz2 android_packages_apps_Trebuchet-25189851ace521c856faf7a9deacf1330b5bef92.zip |
Stop explicitly snapping to page when navigating with keyboard.
When an icon grabs focus, it already snaps to its own page, so
the explicit snapToPage() is redundant. And in the case where no icon
will grab the focus, the explicit call puts us in a weird state
because the page snaps but the focus doesn't change (see bug).
(This happens, for instance, if you are moving from an icon on the
bottom right of page 1 and the only icon on page 2 is in the top
left. In this case, the second icon won't take focus because the
angle is too wide according to FocusLogic#handleDpadHorizontal().)
Bug: 25434120
Change-Id: I17b0ef7d86426a2599bc948bf2313dca7e112364
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r-- | src/com/android/launcher3/FocusHelper.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index d5eac9b2e..8516afb4e 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -142,7 +142,8 @@ public class FocusHelper { newParent = getCellLayoutChildrenForIndex(pagedView, pageIndex + 1); if (newParent != null) { pagedView.snapToPage(pageIndex + 1); - child = FocusLogic.getAdjacentChildInNextPage(newParent, v, newIconIndex); + child = FocusLogic.getAdjacentChildInNextFolderPage( + newParent, v, newIconIndex); } break; case FocusLogic.CURRENT_PAGE_FIRST_ITEM: @@ -364,9 +365,7 @@ public class FocusHelper { } int row = ((CellLayout.LayoutParams) v.getLayoutParams()).cellY; parent = getCellLayoutChildrenForIndex(workspace, newPageIndex); - workspace.snapToPage(newPageIndex); if (parent != null) { - workspace.snapToPage(newPageIndex); iconLayout = (CellLayout) parent.getParent(); matrix = FocusLogic.createSparseMatrix(iconLayout, iconLayout.getCountX(), row); @@ -379,17 +378,14 @@ public class FocusHelper { case FocusLogic.PREVIOUS_PAGE_FIRST_ITEM: parent = getCellLayoutChildrenForIndex(workspace, pageIndex - 1); newIcon = parent.getChildAt(0); - workspace.snapToPage(pageIndex - 1); break; case FocusLogic.PREVIOUS_PAGE_LAST_ITEM: parent = getCellLayoutChildrenForIndex(workspace, pageIndex - 1); newIcon = parent.getChildAt(parent.getChildCount() - 1); - workspace.snapToPage(pageIndex - 1); break; case FocusLogic.NEXT_PAGE_FIRST_ITEM: parent = getCellLayoutChildrenForIndex(workspace, pageIndex + 1); newIcon = parent.getChildAt(0); - workspace.snapToPage(pageIndex + 1); break; case FocusLogic.NEXT_PAGE_LEFT_COLUMN: case FocusLogic.PREVIOUS_PAGE_LEFT_COLUMN: @@ -400,7 +396,6 @@ public class FocusHelper { row = ((CellLayout.LayoutParams) v.getLayoutParams()).cellY; parent = getCellLayoutChildrenForIndex(workspace, newPageIndex); if (parent != null) { - workspace.snapToPage(newPageIndex); iconLayout = (CellLayout) parent.getParent(); matrix = FocusLogic.createSparseMatrix(iconLayout, -1, row); newIconIndex = FocusLogic.handleKeyEvent(keyCode, countX + 1, countY, |