mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 850602 - Handle non-recyclable scrap views properly in TwoWayView (r=mfinkle)
This commit is contained in:
parent
d2ea53e3ea
commit
7e5c064180
@ -4374,6 +4374,10 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldRecycleViewType(int viewType) {
|
||||
return viewType >= 0;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
if (mViewTypeCount == 1) {
|
||||
final ArrayList<View> scrap = mCurrentScrap;
|
||||
@ -4473,10 +4477,26 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
||||
|
||||
lp.scrappedFromPosition = position;
|
||||
|
||||
final int viewType = lp.viewType;
|
||||
final boolean scrapHasTransientState = ViewCompat.hasTransientState(scrap);
|
||||
|
||||
// Don't put views that should be ignored into the scrap heap
|
||||
if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
|
||||
if (scrapHasTransientState) {
|
||||
if (mTransientStateViews == null) {
|
||||
mTransientStateViews = new SparseArrayCompat<View>();
|
||||
}
|
||||
|
||||
mTransientStateViews.put(position, scrap);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (mViewTypeCount == 1) {
|
||||
mCurrentScrap.add(scrap);
|
||||
} else {
|
||||
mScrapViews[lp.viewType].add(scrap);
|
||||
mScrapViews[viewType].add(scrap);
|
||||
}
|
||||
|
||||
if (mRecyclerListener != null) {
|
||||
@ -4500,7 +4520,7 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
||||
activeViews[i] = null;
|
||||
|
||||
final boolean scrapHasTransientState = ViewCompat.hasTransientState(victim);
|
||||
if (scrapHasTransientState) {
|
||||
if (!shouldRecycleViewType(whichScrap) || scrapHasTransientState) {
|
||||
if (scrapHasTransientState) {
|
||||
removeDetachedView(victim, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user