diff options
author | Tony Wickham <twickham@google.com> | 2015-10-21 17:50:22 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2015-10-21 17:50:22 -0700 |
commit | df315180f0653702b470beea62f27927e45fab4b (patch) | |
tree | 346143a3a1c19ee571dd751bede8d37950822b2e | |
parent | d5d7fa10af06518c055d0ce3199c6b65fd21429b (diff) | |
download | android_packages_apps_Trebuchet-df315180f0653702b470beea62f27927e45fab4b.tar.gz android_packages_apps_Trebuchet-df315180f0653702b470beea62f27927e45fab4b.tar.bz2 android_packages_apps_Trebuchet-df315180f0653702b470beea62f27927e45fab4b.zip |
Don't add cells to FocusLogic sparse matrix if they aren't focusable.
Previously, any child of ShortcutAndWidgetContainer was added to the
matrix, causing widgets (which aren't focusable) to be considered as
potential targets to gain focus when an arrow key was pressed. But if
the algorithm chose them, they couldn't take the focus so nothing
happened (i.e. the focus stayed on the app/folder it was on before).
Bug: 25126768
Change-Id: Id55fc310f7f58fb8795cce51dcefe4fd1210f788
-rw-r--r-- | src/com/android/launcher3/util/FocusLogic.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/com/android/launcher3/util/FocusLogic.java b/src/com/android/launcher3/util/FocusLogic.java index 27ce3f127..7f0da77e4 100644 --- a/src/com/android/launcher3/util/FocusLogic.java +++ b/src/com/android/launcher3/util/FocusLogic.java @@ -165,8 +165,12 @@ public class FocusLogic { // Iterate thru the children. for (int i = 0; i < parent.getChildCount(); i++ ) { - int cx = ((CellLayout.LayoutParams) parent.getChildAt(i).getLayoutParams()).cellX; - int cy = ((CellLayout.LayoutParams) parent.getChildAt(i).getLayoutParams()).cellY; + View cell = parent.getChildAt(i); + if (!cell.isFocusable()) { + continue; + } + int cx = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellX; + int cy = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellY; matrix[invert ? (m - cx - 1) : cx][cy] = i; } if (DEBUG) { @@ -199,8 +203,12 @@ public class FocusLogic { // Iterate thru the children of the top parent. for (int i = 0; i < iconParent.getChildCount(); i++) { - int cx = ((CellLayout.LayoutParams) iconParent.getChildAt(i).getLayoutParams()).cellX; - int cy = ((CellLayout.LayoutParams) iconParent.getChildAt(i).getLayoutParams()).cellY; + View cell = iconParent.getChildAt(i); + if (!cell.isFocusable()) { + continue; + } + int cx = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellX; + int cy = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellY; matrix[cx][cy] = i; } @@ -253,8 +261,12 @@ public class FocusLogic { // Iterate thru the children of the top parent. for (int i = 0; i < iconParent.getChildCount(); i++) { - int cx = ((CellLayout.LayoutParams) iconParent.getChildAt(i).getLayoutParams()).cellX; - int cy = ((CellLayout.LayoutParams) iconParent.getChildAt(i).getLayoutParams()).cellY; + View cell = iconParent.getChildAt(i); + if (!cell.isFocusable()) { + continue; + } + int cx = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellX; + int cy = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellY; if (pivotX < 0) { matrix[cx - pivotX][cy] = i; } else { |