summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-04 14:12:02 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-06-04 14:12:02 -0700
commitb640da8fcbc63821dfca1ab92f038771a2bf0ab9 (patch)
tree8ca83ac778baf2f1c3105ea6294170e68811820a /core
parent2b5f84a117ee6f51ed21239719afba0f33c182ff (diff)
parentd296fafab597a6597d9eb276abe6f6eb049e9f12 (diff)
downloadframeworks_base-b640da8fcbc63821dfca1ab92f038771a2bf0ab9.zip
frameworks_base-b640da8fcbc63821dfca1ab92f038771a2bf0ab9.tar.gz
frameworks_base-b640da8fcbc63821dfca1ab92f038771a2bf0ab9.tar.bz2
Merge change 3204 into donut
* changes: Avoid touching all adapter items when building accessibility event.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/ListView.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 99cf6f8..a195ac7 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -1852,18 +1852,25 @@ public class ListView extends AbsListView {
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent 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) {
int itemCount = 0;
int currentItemIndex = getSelectedItemPosition();
ListAdapter adapter = getAdapter();
if (adapter != null) {
- for (int i = 0, count = adapter.getCount(); i < count; i++) {
- if (adapter.isEnabled(i)) {
- itemCount++;
- } else if (i <= currentItemIndex) {
- currentItemIndex--;
+ final int count = adapter.getCount();
+ if (count < 15) {
+ for (int i = 0; i < count; i++) {
+ if (adapter.isEnabled(i)) {
+ itemCount++;
+ } else if (i <= currentItemIndex) {
+ currentItemIndex--;
+ }
}
+ } else {
+ itemCount = count;
}
}