diff options
| author | 2014-03-11 02:15:24 +0000 | |
|---|---|---|
| committer | 2014-03-11 02:15:24 +0000 | |
| commit | 7b09a4e5df908783a95dbfef3bc9fabda339c3a1 (patch) | |
| tree | 3dc4ae3209e8c75c9e2c5eceb27dfd544b7fd2b2 | |
| parent | 3c3377a2290764937548de5a49ca8ec28dc98153 (diff) | |
| parent | e910a7ce8b42580b8bc184dfc340859a65e98c80 (diff) | |
am e910a7ce: Merge "DO NOT MERGE Check item type before re-binding transient state views" into klp-dev
* commit 'e910a7ce8b42580b8bc184dfc340859a65e98c80':
DO NOT MERGE Check item type before re-binding transient state views
| -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 ac3fb017254e..ff7463cd3918 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. |