am 7ef9b612: Merge "Fix monkey bugs in ListView" into klp-dev
* commit '7ef9b612412a2169c8c0e0b3506b06516cb012b5': Fix monkey bugs in ListView
This commit is contained in:
@@ -674,11 +674,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
private int mLastAccessibilityScrollEventFromIndex;
|
private int mLastAccessibilityScrollEventFromIndex;
|
||||||
private int mLastAccessibilityScrollEventToIndex;
|
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.
|
* Track the item count from the last time we handled a data change.
|
||||||
*/
|
*/
|
||||||
@@ -1904,7 +1899,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
|
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
|
||||||
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
||||||
if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
|
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
|
// Data may have changed while we were detached and it's valid
|
||||||
// to change focus while detached. Refresh so we don't die.
|
// to change focus while detached. Refresh so we don't die.
|
||||||
mDataChanged = true;
|
mDataChanged = true;
|
||||||
@@ -2715,7 +2710,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
mOldItemCount = mItemCount;
|
mOldItemCount = mItemCount;
|
||||||
mItemCount = mAdapter.getCount();
|
mItemCount = mAdapter.getCount();
|
||||||
}
|
}
|
||||||
mIsAttached = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2770,7 +2764,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
removeCallbacks(mTouchModeReset);
|
removeCallbacks(mTouchModeReset);
|
||||||
mTouchModeReset.run();
|
mTouchModeReset.run();
|
||||||
}
|
}
|
||||||
mIsAttached = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -3397,7 +3390,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
mPositionScroller.stop();
|
mPositionScroller.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsAttached) {
|
if (!isAttachedToWindow()) {
|
||||||
// Something isn't right.
|
// Something isn't right.
|
||||||
// Since we rely on being attached to get data set change notifications,
|
// 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
|
// 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;
|
mTouchMode = TOUCH_MODE_REST;
|
||||||
child.setPressed(false);
|
child.setPressed(false);
|
||||||
setPressed(false);
|
setPressed(false);
|
||||||
if (!mDataChanged) {
|
if (!mDataChanged && isAttachedToWindow()) {
|
||||||
performClick.run();
|
performClick.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3911,7 +3904,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
mPositionScroller.stop();
|
mPositionScroller.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsAttached) {
|
if (!isAttachedToWindow()) {
|
||||||
// Something isn't right.
|
// Something isn't right.
|
||||||
// Since we rely on being attached to get data set change notifications,
|
// 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
|
// don't risk doing anything where we might try to resync and find things
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ class FastScroller {
|
|||||||
private final Runnable mDeferStartDrag = new Runnable() {
|
private final Runnable mDeferStartDrag = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mList.mIsAttached) {
|
if (mList.isAttachedToWindow()) {
|
||||||
beginDrag();
|
beginDrag();
|
||||||
|
|
||||||
final float pos = getPosFromMotionEvent(mInitialTouchY);
|
final float pos = getPosFromMotionEvent(mInitialTouchY);
|
||||||
|
|||||||
@@ -2122,7 +2122,7 @@ public class ListView extends AbsListView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean commonKey(int keyCode, int count, KeyEvent event) {
|
private boolean commonKey(int keyCode, int count, KeyEvent event) {
|
||||||
if (mAdapter == null || !mIsAttached) {
|
if (mAdapter == null || !isAttachedToWindow()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user