diff options
author | Adam Powell <adamp@google.com> | 2013-09-24 22:38:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-24 22:38:37 +0000 |
commit | 7ef9b612412a2169c8c0e0b3506b06516cb012b5 (patch) | |
tree | e704bc591ee5809bb6f3f6a3e99ecc54fddd28e2 | |
parent | 5ded30c9b780c584c9d1984cc019f7d1d0b38fe5 (diff) | |
parent | 31986b5b696c399b356c8819cb581441027bef36 (diff) | |
download | frameworks_base-7ef9b612412a2169c8c0e0b3506b06516cb012b5.zip frameworks_base-7ef9b612412a2169c8c0e0b3506b06516cb012b5.tar.gz frameworks_base-7ef9b612412a2169c8c0e0b3506b06516cb012b5.tar.bz2 |
Merge "Fix monkey bugs in ListView" into klp-dev
-rw-r--r-- | core/java/android/widget/AbsListView.java | 15 | ||||
-rw-r--r-- | core/java/android/widget/FastScroller.java | 2 | ||||
-rw-r--r-- | core/java/android/widget/ListView.java | 2 |
3 files changed, 6 insertions, 13 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 7378d74..41a8fd1 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -675,11 +675,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private int mLastAccessibilityScrollEventToIndex; /** - * Track if we are currently attached to a window. - */ - boolean mIsAttached; - - /** * Track the item count from the last time we handled a data change. */ private int mLastHandledItemCount; @@ -1904,7 +1899,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) { - if (!mIsAttached && mAdapter != null) { + if (!isAttachedToWindow() && mAdapter != null) { // Data may have changed while we were detached and it's valid // to change focus while detached. Refresh so we don't die. mDataChanged = true; @@ -2715,7 +2710,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mOldItemCount = mItemCount; mItemCount = mAdapter.getCount(); } - mIsAttached = true; } @Override @@ -2770,7 +2764,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te removeCallbacks(mTouchModeReset); mTouchModeReset.run(); } - mIsAttached = false; } @Override @@ -3397,7 +3390,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mPositionScroller.stop(); } - if (!mIsAttached) { + if (!isAttachedToWindow()) { // Something isn't right. // Since we rely on being attached to get data set change notifications, // don't risk doing anything where we might try to resync and find things @@ -3636,7 +3629,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mTouchMode = TOUCH_MODE_REST; child.setPressed(false); setPressed(false); - if (!mDataChanged) { + if (!mDataChanged && isAttachedToWindow()) { performClick.run(); } } @@ -3911,7 +3904,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mPositionScroller.stop(); } - if (!mIsAttached) { + if (!isAttachedToWindow()) { // Something isn't right. // Since we rely on being attached to get data set change notifications, // don't risk doing anything where we might try to resync and find things diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index 006b96e..e2f6d7d 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -210,7 +210,7 @@ class FastScroller { private final Runnable mDeferStartDrag = new Runnable() { @Override public void run() { - if (mList.mIsAttached) { + if (mList.isAttachedToWindow()) { beginDrag(); final float pos = getPosFromMotionEvent(mInitialTouchY); diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index b239fbd..4b00f90 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -2122,7 +2122,7 @@ public class ListView extends AbsListView { } private boolean commonKey(int keyCode, int count, KeyEvent event) { - if (mAdapter == null || !mIsAttached) { + if (mAdapter == null || !isAttachedToWindow()) { return false; } |