am 8a6ba494: Merge "All runnable are stopped on detach. DO NOT MERGE." into gingerbread

* commit '8a6ba494a28702e68b0a8fbd8bac34335536a8f8':
  All runnable are stopped on detach. DO NOT MERGE.
This commit is contained in:
Gilles Debunne
2011-02-04 15:50:12 -08:00
committed by Android Git Automerger

View File

@@ -3831,6 +3831,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
hideError(); hideError();
} }
if (mBlink != null) {
mBlink.cancel();
}
if (mInsertionPointCursorController != null) {
mInsertionPointCursorController.onDetached();
}
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.onDetached();
}
hideControllers(); hideControllers();
} }
@@ -7740,6 +7752,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @param event The touch event * @param event The touch event
*/ */
public boolean onTouchEvent(MotionEvent event); public boolean onTouchEvent(MotionEvent event);
/**
* Called when the view is detached from window. Perform house keeping task, such as
* stopping Runnable thread that would otherwise keep a reference on the context, thus
* preventing the activity to be recycled.
*/
public void onDetached();
} }
private class HandleView extends View { private class HandleView extends View {
@@ -8017,12 +8036,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
public void hide() { public void hide() {
mHandle.hide(); mHandle.hide();
TextView.this.removeCallbacks(mHider); removeCallbacks(mHider);
} }
private void hideDelayed(int msec) { private void hideDelayed(int msec) {
TextView.this.removeCallbacks(mHider); removeCallbacks(mHider);
TextView.this.postDelayed(mHider, msec); postDelayed(mHider, msec);
} }
public boolean isShowing() { public boolean isShowing() {
@@ -8062,6 +8081,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
hide(); hide();
} }
} }
@Override
public void onDetached() {
removeCallbacks(mHider);
}
} }
private class SelectionModifierCursorController implements CursorController { private class SelectionModifierCursorController implements CursorController {
@@ -8219,6 +8243,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
hide(); hide();
} }
} }
@Override
public void onDetached() {
removeCallbacks(mHider);
}
} }
private void hideInsertionPointCursorController() { private void hideInsertionPointCursorController() {