Merge change 3204 into donut
* changes: Avoid touching all adapter items when building accessibility event.
This commit is contained in:
@ -1852,19 +1852,26 @@ public class ListView extends AbsListView {
|
|||||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||||
boolean populated = super.dispatchPopulateAccessibilityEvent(event);
|
boolean populated = super.dispatchPopulateAccessibilityEvent(event);
|
||||||
|
|
||||||
|
// If the item count is less than 15 then subtract disabled items from the count and
|
||||||
|
// position. Otherwise ignore disabled items.
|
||||||
if (!populated) {
|
if (!populated) {
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
int currentItemIndex = getSelectedItemPosition();
|
int currentItemIndex = getSelectedItemPosition();
|
||||||
|
|
||||||
ListAdapter adapter = getAdapter();
|
ListAdapter adapter = getAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
for (int i = 0, count = adapter.getCount(); i < count; i++) {
|
final int count = adapter.getCount();
|
||||||
|
if (count < 15) {
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
if (adapter.isEnabled(i)) {
|
if (adapter.isEnabled(i)) {
|
||||||
itemCount++;
|
itemCount++;
|
||||||
} else if (i <= currentItemIndex) {
|
} else if (i <= currentItemIndex) {
|
||||||
currentItemIndex--;
|
currentItemIndex--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
itemCount = count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setItemCount(itemCount);
|
event.setItemCount(itemCount);
|
||||||
|
Reference in New Issue
Block a user