diff options
author | Hyunyoung Song <hyunyoungs@google.com> | 2015-04-16 14:34:09 -0700 |
---|---|---|
committer | Hyunyoung Song <hyunyoungs@google.com> | 2015-04-16 14:34:09 -0700 |
commit | b76cd628e657fd050ccf3f4dc31b2e8bc36356e5 (patch) | |
tree | b552094078cae29d77d811e80d0693700aa71742 /src/com/android/launcher3/FocusHelper.java | |
parent | 317073ca2df775d3fae445b82e83f0314f2dcfe3 (diff) | |
download | android_packages_apps_Trebuchet-b76cd628e657fd050ccf3f4dc31b2e8bc36356e5.tar.gz android_packages_apps_Trebuchet-b76cd628e657fd050ccf3f4dc31b2e8bc36356e5.tar.bz2 android_packages_apps_Trebuchet-b76cd628e657fd050ccf3f4dc31b2e8bc36356e5.zip |
Focus handling null pointer exception during monkey tests.
- Also fix a bug where the focus is not navigating to the next page when there
isn't an icon within +45 and -45 range of the origin.
b/20294717
Change-Id: I16dac5c6a0463fbc9f56a447abedad18abadde98
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r-- | src/com/android/launcher3/FocusHelper.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index 8791c896a..32ed98c17 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -222,7 +222,7 @@ public class FocusHelper { Hotseat hotseat = (Hotseat) hotseatLayout.getParent(); Workspace workspace = (Workspace) v.getRootView().findViewById(R.id.workspace); - int pageIndex = workspace.getCurrentPage(); + int pageIndex = workspace.getNextPage(); int pageCount = workspace.getChildCount(); int countX = -1; int countY = -1; @@ -231,6 +231,12 @@ public class FocusHelper { .getChildAt(iconIndex).getLayoutParams()).cellX; final CellLayout iconLayout = (CellLayout) workspace.getChildAt(pageIndex); + if (iconLayout == null) { + // This check is to guard against cases where key strokes rushes in when workspace + // child creation/deletion is still in flux. (e.g., during drop or fling + // animation.) + return consume; + } final ViewGroup iconParent = iconLayout.getShortcutsAndWidgets(); ViewGroup parent = null; @@ -364,6 +370,7 @@ public class FocusHelper { } int row = FocusLogic.findRow(matrix, iconIndex); parent = getCellLayoutChildrenForIndex(workspace, newPageIndex); + workspace.snapToPage(newPageIndex); if (parent != null) { iconLayout = (CellLayout) parent.getParent(); matrix = FocusLogic.createSparseMatrix(iconLayout, @@ -394,6 +401,7 @@ public class FocusHelper { if (newIconIndex == FocusLogic.PREVIOUS_PAGE_LEFT_COLUMN) { newPageIndex = pageIndex - 1; } + workspace.snapToPage(newPageIndex); row = FocusLogic.findRow(matrix, iconIndex); parent = getCellLayoutChildrenForIndex(workspace, newPageIndex); if (parent != null) { |