Merge "Fix problem with ListView accessibility focus" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
36bceefafa
@@ -6873,9 +6873,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
mTransientStateViews.put(position, scrap);
|
mTransientStateViews.put(position, scrap);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we'll have to remove the view and start over.
|
// Otherwise, we'll have to remove the view and start over.
|
||||||
|
clearScrapForRebind(scrap);
|
||||||
getSkippedScrap().add(scrap);
|
getSkippedScrap().add(scrap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
clearScrapForRebind(scrap);
|
||||||
if (mViewTypeCount == 1) {
|
if (mViewTypeCount == 1) {
|
||||||
mCurrentScrap.add(scrap);
|
mCurrentScrap.add(scrap);
|
||||||
} else {
|
} else {
|
||||||
@@ -7098,12 +7100,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
}
|
}
|
||||||
} else if (params.scrappedFromPosition == position) {
|
} else if (params.scrappedFromPosition == position) {
|
||||||
final View scrap = scrapViews.remove(i);
|
final View scrap = scrapViews.remove(i);
|
||||||
clearAccessibilityFromScrap(scrap);
|
clearScrapForRebind(scrap);
|
||||||
return scrap;
|
return scrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final View scrap = scrapViews.remove(size - 1);
|
final View scrap = scrapViews.remove(size - 1);
|
||||||
clearAccessibilityFromScrap(scrap);
|
clearScrapForRebind(scrap);
|
||||||
return scrap;
|
return scrap;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -7117,7 +7119,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearAccessibilityFromScrap(View view) {
|
private void clearScrapForRebind(View view) {
|
||||||
view.clearAccessibilityFocus();
|
view.clearAccessibilityFocus();
|
||||||
view.setAccessibilityDelegate(null);
|
view.setAccessibilityDelegate(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1639,7 +1639,7 @@ public class ListView extends AbsListView {
|
|||||||
final View focusChild = getAccessibilityFocusedChild(focusHost);
|
final View focusChild = getAccessibilityFocusedChild(focusHost);
|
||||||
if (focusChild != null) {
|
if (focusChild != null) {
|
||||||
if (!dataChanged || isDirectChildHeaderOrFooter(focusChild)
|
if (!dataChanged || isDirectChildHeaderOrFooter(focusChild)
|
||||||
|| focusChild.hasTransientState() || mAdapterHasStableIds) {
|
|| (focusChild.hasTransientState() && mAdapterHasStableIds)) {
|
||||||
// The views won't be changing, so try to maintain
|
// The views won't be changing, so try to maintain
|
||||||
// focus on the current host and virtual view.
|
// focus on the current host and virtual view.
|
||||||
accessibilityFocusLayoutRestoreView = focusHost;
|
accessibilityFocusLayoutRestoreView = focusHost;
|
||||||
|
|||||||
Reference in New Issue
Block a user