summaryrefslogtreecommitdiff
path: root/core/java/android/widget/GridView.java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-01-06 18:48:08 -0800
committerRomain Guy <romainguy@android.com>2010-01-06 18:48:08 -0800
commit21875052adddf2b52bc57fea62bf097b8aa04cbf (patch)
tree4e21422f35bc1b5305ded8e94fc536dc2f35a9e5 /core/java/android/widget/GridView.java
parent3e7b44fade95848a717b0f4d1b7365ce72e885ed (diff)
Fix two ListView bugs related to onAttachedToWindow/onDetachedFromWindow.
Bug: #2359368. onDetachedFromWindow() would never be called for views living in the scrap heap, but onAttachedToWindow() could be called several times for views recycled from the scrap heap.
Diffstat (limited to 'core/java/android/widget/GridView.java')
-rw-r--r--core/java/android/widget/GridView.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index ffe9908e892b..2e91e52aaac6 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -931,7 +931,7 @@ public class GridView extends AbsListView {
mItemCount = mAdapter == null ? 0 : mAdapter.getCount();
final int count = mItemCount;
if (count > 0) {
- final View child = obtainView(0);
+ final View child = obtainView(0, mIsScrap);
AbsListView.LayoutParams p = (AbsListView.LayoutParams)child.getLayoutParams();
if (p == null) {
@@ -1203,7 +1203,7 @@ public class GridView extends AbsListView {
View child;
if (!mDataChanged) {
- // Try to use an exsiting view for this position
+ // Try to use an existing view for this position
child = mRecycler.getActiveView(position);
if (child != null) {
// Found it -- we're using an existing child
@@ -1215,10 +1215,10 @@ public class GridView extends AbsListView {
// Make a new view for this position, or convert an unused view if
// possible
- child = obtainView(position);
+ child = obtainView(position, mIsScrap);
// This needs to be positioned and measured
- setupChild(child, position, y, flow, childrenLeft, selected, false, where);
+ setupChild(child, position, y, flow, childrenLeft, selected, mIsScrap[0], where);
return child;
}