diff options
author | Alan Viverette <alanv@google.com> | 2014-03-13 18:02:14 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-13 18:02:14 +0000 |
commit | 839321a362ec1cd40fc7267a7883641bcc8ee429 (patch) | |
tree | ba3992cf81498151d99df0628cbe214269f81062 /core/java/android/widget | |
parent | ba3d0fd5fc520d1a6dcf6e6abc5f9d90c08e9f88 (diff) | |
parent | c25dbb50c30816c97227b9a26cc46afec4e5318e (diff) | |
download | frameworks_base-839321a362ec1cd40fc7267a7883641bcc8ee429.zip frameworks_base-839321a362ec1cd40fc7267a7883641bcc8ee429.tar.gz frameworks_base-839321a362ec1cd40fc7267a7883641bcc8ee429.tar.bz2 |
am c25dbb50: am 7b09a4e5: am e910a7ce: Merge "DO NOT MERGE Check item type before re-binding transient state views" into klp-dev
* commit 'c25dbb50c30816c97227b9a26cc46afec4e5318e':
DO NOT MERGE Check item type before re-binding transient state views
Diffstat (limited to 'core/java/android/widget')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index ac3fb01..ff7463c 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2233,10 +2233,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te // data and discard the view if we fail. final View transientView = mRecycler.getTransientStateView(position); if (transientView != null) { - final View updatedView = mAdapter.getView(position, transientView, this); - if (updatedView != transientView) { - // Failed to re-bind the data, scrap the obtained view. - mRecycler.addScrapView(updatedView, position); + final LayoutParams params = (LayoutParams) transientView.getLayoutParams(); + + // If the view type hasn't changed, attempt to re-bind the data. + if (params.viewType == mAdapter.getItemViewType(position)) { + final View updatedView = mAdapter.getView(position, transientView, this); + + // If we failed to re-bind the data, scrap the obtained view. + if (updatedView != transientView) { + mRecycler.addScrapView(updatedView, position); + } } // Scrap view implies temporary detachment. |