diff options
author | Yorke Lee <yorkelee@google.com> | 2013-05-28 10:07:57 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-05-28 10:07:57 -0700 |
commit | 53f35c7c31f31db40b106cc0f7a51f5daf40a7fd (patch) | |
tree | 588feb3a781aec3f5296bd31a6787710bab50acf /common | |
parent | 1b1e52969c8efaf52632206d58a8302db5019064 (diff) | |
download | android_frameworks_ex-53f35c7c31f31db40b106cc0f7a51f5daf40a7fd.tar.gz android_frameworks_ex-53f35c7c31f31db40b106cc0f7a51f5daf40a7fd.tar.bz2 android_frameworks_ex-53f35c7c31f31db40b106cc0f7a51f5daf40a7fd.zip |
Fix for CompositeCursorAdapter returning wrong item view types
Cherrypick of
https://googleplex-android-review.googlesource.com/#/c/306995/,
which fixes the bug that causes getItemViewType to be called
with the wrong position, causing new views to be created
unnecessarily.
Bug: 8398321
Change-Id: I6c921fe7d5135cf9f9d9bdd08b5aa4df7662ac1c
Diffstat (limited to 'common')
-rw-r--r-- | common/java/com/android/common/widget/CompositeCursorAdapter.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/java/com/android/common/widget/CompositeCursorAdapter.java b/common/java/com/android/common/widget/CompositeCursorAdapter.java index d6064e1..605eb82 100644 --- a/common/java/com/android/common/widget/CompositeCursorAdapter.java +++ b/common/java/com/android/common/widget/CompositeCursorAdapter.java @@ -309,10 +309,14 @@ public abstract class CompositeCursorAdapter extends BaseAdapter { int end = start + mPartitions[i].count; if (position >= start && position < end) { int offset = position - start; - if (mPartitions[i].hasHeader && offset == 0) { + if (mPartitions[i].hasHeader) { + offset--; + } + if (offset == -1) { return IGNORE_ITEM_VIEW_TYPE; + } else { + return getItemViewType(i, offset); } - return getItemViewType(i, position); } start = end; } |