diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-07-02 18:12:00 -0700 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-07-02 18:21:31 -0700 |
| commit | 27e2da7c171afa39358bbead18fbe3e6b8ea6637 (patch) | |
| tree | a506f123a83de24081650f819db65b2b5e3f92cb /core/java/android/view/FocusFinder.java | |
| parent | 0a6101b2adaae2128e4cad8247f827c164b8d657 (diff) | |
Remove the accessibility focus search code.
1. In JellyBean we have added some APIs to search for next accessibility
focus in various directions and set accessibility focus from hover.
However, we have decided that there is not clean answer for how this
should behave and the APIs were hidden. Now the accessibility service
is responsible for that. The unused code is now taken out.
2. This patch also takes out the hidden attribute accessibiligyFocusable
since we moved the responsibility for implementing focus search strategy
to accessibility services and we did not need that for Jellybean which
is a good sign that this is not needed. I general this is one less thing
for an app developer to worry about. We can add this if needed later.
bug:6773816
Change-Id: I0c858d72c93a2b7ff1f8f35a08d33ec4b9eb85fd
Diffstat (limited to 'core/java/android/view/FocusFinder.java')
| -rw-r--r-- | core/java/android/view/FocusFinder.java | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java index 31a9f05a1054..351c5c31f270 100644 --- a/core/java/android/view/FocusFinder.java +++ b/core/java/android/view/FocusFinder.java @@ -79,17 +79,9 @@ public class FocusFinder { } private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction) { - if ((direction & View.FOCUS_ACCESSIBILITY) != View.FOCUS_ACCESSIBILITY) { - return findNextInputFocus(root, focused, focusedRect, direction); - } else { - return findNextAccessibilityFocus(root, focused, focusedRect, direction); - } - } - - private View findNextInputFocus(ViewGroup root, View focused, Rect focusedRect, int direction) { View next = null; if (focused != null) { - next = findNextUserSpecifiedInputFocus(root, focused, direction); + next = findNextUserSpecifiedFocus(root, focused, direction); } if (next != null) { return next; @@ -107,7 +99,7 @@ public class FocusFinder { return next; } - private View findNextUserSpecifiedInputFocus(ViewGroup root, View focused, int direction) { + private View findNextUserSpecifiedFocus(ViewGroup root, View focused, int direction) { // check for user specified next focus View userSetNextFocus = focused.findUserSetNextFocus(root, direction); if (userSetNextFocus != null && userSetNextFocus.isFocusable() @@ -120,7 +112,6 @@ public class FocusFinder { private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction, ArrayList<View> focusables) { - final int directionMasked = (direction & ~View.FOCUS_ACCESSIBILITY); if (focused != null) { if (focusedRect == null) { focusedRect = mFocusedRect; @@ -132,7 +123,7 @@ public class FocusFinder { if (focusedRect == null) { focusedRect = mFocusedRect; // make up a rect at top left or bottom right of root - switch (directionMasked) { + switch (direction) { case View.FOCUS_RIGHT: case View.FOCUS_DOWN: setFocusTopLeft(root, focusedRect); @@ -160,37 +151,23 @@ public class FocusFinder { } } - switch (directionMasked) { + switch (direction) { case View.FOCUS_FORWARD: case View.FOCUS_BACKWARD: - return findNextInputFocusInRelativeDirection(focusables, root, focused, focusedRect, - directionMasked); + return findNextFocusInRelativeDirection(focusables, root, focused, focusedRect, + direction); case View.FOCUS_UP: case View.FOCUS_DOWN: case View.FOCUS_LEFT: case View.FOCUS_RIGHT: - return findNextInputFocusInAbsoluteDirection(focusables, root, focused, - focusedRect, directionMasked); + return findNextFocusInAbsoluteDirection(focusables, root, focused, + focusedRect, direction); default: - throw new IllegalArgumentException("Unknown direction: " + directionMasked); - } - } - - private View findNextAccessibilityFocus(ViewGroup root, View focused, - Rect focusedRect, int direction) { - ArrayList<View> focusables = mTempList; - try { - focusables.clear(); - root.addFocusables(focusables, direction, View.FOCUSABLES_ACCESSIBILITY); - View next = findNextFocus(root, focused, focusedRect, direction, - focusables); - return next; - } finally { - focusables.clear(); + throw new IllegalArgumentException("Unknown direction: " + direction); } } - private View findNextInputFocusInRelativeDirection(ArrayList<View> focusables, ViewGroup root, + private View findNextFocusInRelativeDirection(ArrayList<View> focusables, ViewGroup root, View focused, Rect focusedRect, int direction) { try { // Note: This sort is stable. @@ -222,7 +199,7 @@ public class FocusFinder { focusedRect.set(rootLeft, rootTop, rootLeft, rootTop); } - View findNextInputFocusInAbsoluteDirection(ArrayList<View> focusables, ViewGroup root, View focused, + View findNextFocusInAbsoluteDirection(ArrayList<View> focusables, ViewGroup root, View focused, Rect focusedRect, int direction) { // initialize the best candidate to something impossible // (so the first plausible view will become the best choice) |
