Merge "DO NOT MERGE Check item type before re-binding transient state views" into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e910a7ce8b
@@ -2233,10 +2233,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
// data and discard the view if we fail.
|
// data and discard the view if we fail.
|
||||||
final View transientView = mRecycler.getTransientStateView(position);
|
final View transientView = mRecycler.getTransientStateView(position);
|
||||||
if (transientView != null) {
|
if (transientView != null) {
|
||||||
final View updatedView = mAdapter.getView(position, transientView, this);
|
final LayoutParams params = (LayoutParams) transientView.getLayoutParams();
|
||||||
if (updatedView != transientView) {
|
|
||||||
// Failed to re-bind the data, scrap the obtained view.
|
// If the view type hasn't changed, attempt to re-bind the data.
|
||||||
mRecycler.addScrapView(updatedView, position);
|
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.
|
// Scrap view implies temporary detachment.
|
||||||
|
|||||||
Reference in New Issue
Block a user