diff options
author | Yabin Huang <yabinh@google.com> | 2020-07-23 17:39:45 +0000 |
---|---|---|
committer | Yabin Huang <yabinh@google.com> | 2020-07-23 17:52:12 +0000 |
commit | 6c01bf5f87c0572b7ef872438fc0d0dfe6a03753 (patch) | |
tree | 9582e069832b6370f801f1d72f15fa359ff639c8 | |
parent | 713af5fdd39a2b56efe89d1125d6864f92c6298f (diff) | |
download | base-6c01bf5f87c0572b7ef872438fc0d0dfe6a03753.tar.gz |
Revert "Update FocusFinder"
Revert submission 11830696-b/158492287-stage-aosp-rvc-ts-dev
Reason for revert: It's too late to merge this CL to rvc-dev. Let's revert it and merge it to rvc-qpr-dev.
Reverted Changes:
Ib5c1854d1:Update FocusFinder
Change-Id: I5f50166322b662b457e1b79b2ce62c622ddd1013
-rw-r--r-- | core/java/android/view/FocusFinder.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java index 064bc6947fc4..713cfb48c95f 100644 --- a/core/java/android/view/FocusFinder.java +++ b/core/java/android/view/FocusFinder.java @@ -311,9 +311,6 @@ public class FocusFinder { } final int count = focusables.size(); - if (count < 2) { - return null; - } switch (direction) { case View.FOCUS_FORWARD: return getNextFocusable(focused, focusables, count); @@ -376,29 +373,29 @@ public class FocusFinder { } private static View getNextFocusable(View focused, ArrayList<View> focusables, int count) { - if (count < 2) { - return null; - } if (focused != null) { int position = focusables.lastIndexOf(focused); if (position >= 0 && position + 1 < count) { return focusables.get(position + 1); } } - return focusables.get(0); + if (!focusables.isEmpty()) { + return focusables.get(0); + } + return null; } private static View getPreviousFocusable(View focused, ArrayList<View> focusables, int count) { - if (count < 2) { - return null; - } if (focused != null) { int position = focusables.indexOf(focused); if (position > 0) { return focusables.get(position - 1); } } - return focusables.get(count - 1); + if (!focusables.isEmpty()) { + return focusables.get(count - 1); + } + return null; } private static View getNextKeyboardNavigationCluster( |