From b552d89e901225e2b6aa2602e874ab984c638415 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Sat, 2 Jun 2012 14:35:02 -0700 Subject: Double input focus and focus movement in list not working. 1. The clearFocus routine in ViewGroup was clearing the pointer to the descendant which has focus after calling clear focus on that child. However, currently clearing the focus of a view causes the view that loses focus to try to give the focus to the first focusable which potentially sets the pointer to the child that has input focus in the ViewGroup but the ViewGruop essentially clears that pointer. This resulted in having two focused views at the same time in some cases. 2. AbsListView was not calling the super implementation of add focusables if the focus type was not accessibility. bug:6559819 Change-Id: I478dfed000b5de3f9b15e12eb82aa3d34c2301e4 --- core/java/android/view/ViewGroup.java | 3 ++- core/java/android/widget/AbsListView.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index a243c73..e7b0e78 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -765,8 +765,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (mFocused == null) { super.clearFocus(); } else { - mFocused.clearFocus(); + View focused = mFocused; mFocused = null; + focused.clearFocus(); } } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index a84ece6..94aa0f6 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1344,8 +1344,8 @@ public abstract class AbsListView extends AdapterView implements Te } } return; } - super.addFocusables(views, direction, focusableMode); } + super.addFocusables(views, direction, focusableMode); } @Override -- cgit v1.1