summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-02-25 17:32:54 -0800
committerRomain Guy <romainguy@android.com>2010-02-25 17:34:59 -0800
commit9c3184cc162ee8c10eabd3f996629a9397a1f551 (patch)
treecfbc3fc8d0539a6bbd854eba3779825b79cacf2f /core
parent3f3e53bc30dbf0e47c90be5cf4bd4faabda9c601 (diff)
downloadframeworks_base-9c3184cc162ee8c10eabd3f996629a9397a1f551.zip
frameworks_base-9c3184cc162ee8c10eabd3f996629a9397a1f551.tar.gz
frameworks_base-9c3184cc162ee8c10eabd3f996629a9397a1f551.tar.bz2
Do not recyle headers and footers when measuring the ListView.
Bug #2461893 This was causing headers and footers to be in a wrong state after the first recycling pass, which would cause them to be detached from the window. This was in turn preventing invalidate operations from performing successfully.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/AbsListView.java4
-rw-r--r--core/java/android/widget/ListView.java8
2 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index a9b746a..bec62b1 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -4155,9 +4155,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
final View[] activeViews = mActiveViews;
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
- AbsListView.LayoutParams lp = (AbsListView.LayoutParams)child.getLayoutParams();
+ AbsListView.LayoutParams lp = (AbsListView.LayoutParams) child.getLayoutParams();
// Don't put header or footer views into the scrap heap
- if (lp != null && lp.viewType != AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
+ if (lp != null && lp.viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
// Note: We do place AdapterView.ITEM_VIEW_TYPE_IGNORE in active views.
// However, we will NOT place them into scrap views.
activeViews[i] = child;
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 51a1ef2..912dd5e 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -138,7 +138,7 @@ public class ListView extends AbsListView {
// the single allocated result per list view; kinda cheesey but avoids
// allocating these thingies too often.
- private ArrowScrollFocusResult mArrowScrollFocusResult = new ArrowScrollFocusResult();
+ private final ArrowScrollFocusResult mArrowScrollFocusResult = new ArrowScrollFocusResult();
public ListView(Context context) {
this(context, null);
@@ -1040,7 +1040,8 @@ public class ListView extends AbsListView {
childWidth = child.getMeasuredWidth();
childHeight = child.getMeasuredHeight();
- if (recycleOnMeasure()) {
+ if (recycleOnMeasure() && mRecycler.shouldRecycleViewType(
+ ((LayoutParams) child.getLayoutParams()).viewType)) {
mRecycler.addScrapView(child);
}
}
@@ -1155,7 +1156,8 @@ public class ListView extends AbsListView {
}
// Recycle the view before we possibly return from the method
- if (recyle) {
+ if (recyle && recycleBin.shouldRecycleViewType(
+ ((LayoutParams) child.getLayoutParams()).viewType)) {
recycleBin.addScrapView(child);
}