diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-15 11:38:57 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-15 11:38:57 -0700 |
| commit | 38f4c223c0fde274c2089b1dad026593c06de06f (patch) | |
| tree | bf2a1ca419c967ccccea45413e6cac3a421ba740 /core/java/android/view/ViewGroup.java | |
| parent | f2d3c418c43dcbfbc9c22ca4f1c6d86297f67ee0 (diff) | |
| parent | d83a0800679583ccc99a90a128f8d6c11afbeca4 (diff) | |
am d83a0800: am 8ce2d78a: Merge "Improving accessibility focus traversal." into jb-dev
* commit 'd83a0800679583ccc99a90a128f8d6c11afbeca4':
Improving accessibility focus traversal.
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 9eb49984bf3c..0020efd4ceab 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -628,7 +628,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * FOCUS_RIGHT, or 0 for not applicable. */ public View focusSearch(View focused, int direction) { - if (isRootNamespace()) { + // If we are moving accessibility focus we want to consider all + // views no matter if they are on the screen. It is responsibility + // of the accessibility service to check whether the result is in + // the screen. + if (isRootNamespace() && (direction & FOCUS_ACCESSIBILITY) == 0) { // root namespace means we should consider ourselves the top of the // tree for focus searching; otherwise we could be focus searching // into other tabs. see LocalActivityManager and TabHost for more info @@ -857,20 +861,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * {@inheritDoc} */ @Override - public void addFocusables(ArrayList<View> views, int direction) { - addFocusables(views, direction, FOCUSABLES_TOUCH_MODE); - } - - /** - * {@inheritDoc} - */ - @Override public void addFocusables(ArrayList<View> views, int direction, int focusableMode) { final int focusableCount = views.size(); final int descendantFocusability = getDescendantFocusability(); - if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) { + if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS + || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { final int count = mChildrenCount; final View[] children = mChildren; @@ -886,10 +883,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // FOCUS_AFTER_DESCENDANTS and there are some descendants focusable. this is // to avoid the focus search finding layouts when a more precise search // among the focusable children would be more interesting. - if ( - descendantFocusability != FOCUS_AFTER_DESCENDANTS || + if (descendantFocusability != FOCUS_AFTER_DESCENDANTS // No focusable descendants - (focusableCount == views.size())) { + || (focusableCount == views.size()) + // We are collecting accessibility focusables. + || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { super.addFocusables(views, direction, focusableMode); } } @@ -1659,6 +1657,20 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** + * @hide + */ + @Override + public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { + if (includeForAccessibility() && isActionableForAccessibility()) { + return this; + } + if (mParent != null) { + return mParent.findViewToTakeAccessibilityFocusFromHover(this, descendant); + } + return null; + } + + /** * Implement this method to intercept hover events before they are handled * by child views. * <p> |
