diff options
| author | 2017-06-02 00:45:09 +0000 | |
|---|---|---|
| committer | 2017-06-02 00:45:17 +0000 | |
| commit | 3653aed87b24c83db720b088894a82253d50b9da (patch) | |
| tree | b046cb6cb54e174285b3925c8eb6461f48594707 | |
| parent | b34c9d3a33eb6acba655f648c9276a467f73b937 (diff) | |
| parent | 8c8ac8125ac93e87733994190bb54925d188bdc1 (diff) | |
Merge "Enabled (asymmetric) tab selection in GridView" into oc-dev
| -rw-r--r-- | core/java/android/widget/GridView.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index 82071d747775..fcb44af672d5 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -1718,20 +1718,17 @@ public class GridView extends AbsListView { break; case KeyEvent.KEYCODE_TAB: - // XXX Sometimes it is useful to be able to TAB through the items in + // TODO: Sometimes it is useful to be able to TAB through the items in // a GridView sequentially. Unfortunately this can create an // asymmetry in TAB navigation order unless the list selection // always reverts to the top or bottom when receiving TAB focus from - // another widget. Leaving this behavior disabled for now but - // perhaps it should be configurable (and more comprehensive). - if (false) { - if (event.hasNoModifiers()) { - handled = resurrectSelectionIfNeeded() - || sequenceScroll(FOCUS_FORWARD); - } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { - handled = resurrectSelectionIfNeeded() - || sequenceScroll(FOCUS_BACKWARD); - } + // another widget. + if (event.hasNoModifiers()) { + handled = resurrectSelectionIfNeeded() + || sequenceScroll(FOCUS_FORWARD); + } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { + handled = resurrectSelectionIfNeeded() + || sequenceScroll(FOCUS_BACKWARD); } break; } @@ -1991,7 +1988,7 @@ public class GridView extends AbsListView { if (!mStackFromBottom) { rowStart = childIndex - (childIndex % mNumColumns); - rowEnd = Math.max(rowStart + mNumColumns - 1, count); + rowEnd = Math.min(rowStart + mNumColumns - 1, count); } else { rowEnd = count - 1 - (invertedIndex - (invertedIndex % mNumColumns)); rowStart = Math.max(0, rowEnd - mNumColumns + 1); |