am 4c72ad75: Merge "Fix bug 2918587 Infinite loop and memory leak in AdapterView" into gingerbread
Merge commit '4c72ad75cfb413f54cb59d413a232e77c7260ef2' into gingerbread-plus-aosp * commit '4c72ad75cfb413f54cb59d413a232e77c7260ef2': Fix bug 2918587 Infinite loop and memory leak in AdapterView
This commit is contained in:
@@ -808,7 +808,6 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
|
|||||||
mNextSelectedPosition = INVALID_POSITION;
|
mNextSelectedPosition = INVALID_POSITION;
|
||||||
mNextSelectedRowId = INVALID_ROW_ID;
|
mNextSelectedRowId = INVALID_ROW_ID;
|
||||||
mNeedSync = false;
|
mNeedSync = false;
|
||||||
checkSelectionChanged();
|
|
||||||
|
|
||||||
checkFocus();
|
checkFocus();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
@@ -819,13 +818,21 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SelectionNotifier extends Handler implements Runnable {
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
removeCallbacks(mSelectionNotifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SelectionNotifier implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mDataChanged) {
|
if (mDataChanged) {
|
||||||
// Data has changed between when this SelectionNotifier
|
// Data has changed between when this SelectionNotifier
|
||||||
// was posted and now. We need to wait until the AdapterView
|
// was posted and now. We need to wait until the AdapterView
|
||||||
// has been synched to the new data.
|
// has been synched to the new data.
|
||||||
|
if (getAdapter() != null) {
|
||||||
post(this);
|
post(this);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fireOnSelected();
|
fireOnSelected();
|
||||||
}
|
}
|
||||||
@@ -842,7 +849,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
|
|||||||
if (mSelectionNotifier == null) {
|
if (mSelectionNotifier == null) {
|
||||||
mSelectionNotifier = new SelectionNotifier();
|
mSelectionNotifier = new SelectionNotifier();
|
||||||
}
|
}
|
||||||
mSelectionNotifier.post(mSelectionNotifier);
|
post(mSelectionNotifier);
|
||||||
} else {
|
} else {
|
||||||
fireOnSelected();
|
fireOnSelected();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user