summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2014-03-13 18:08:40 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-03-13 18:08:40 +0000
commit17bbdcc549a0469fa3d8ed5778e77964ab7caf2d (patch)
tree7a399c551a9ec0493cca152578efe048ab8a8206
parentc59474d2813be8df40090ca121f9570977796aa7 (diff)
parent839321a362ec1cd40fc7267a7883641bcc8ee429 (diff)
am 839321a3: am c25dbb50: am 7b09a4e5: am e910a7ce: Merge "DO NOT MERGE Check item type before re-binding transient state views" into klp-dev
* commit '839321a362ec1cd40fc7267a7883641bcc8ee429': DO NOT MERGE Check item type before re-binding transient state views
-rw-r--r--core/java/android/widget/AbsListView.java14
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.