Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a6ba494 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "All runnable are stopped on detach. DO NOT MERGE." into gingerbread

parents 53841df2 d5253fae
Loading
Loading
Loading
Loading
+32 −3
Original line number Diff line number Diff line
@@ -3815,6 +3815,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            hideError();
        }

        if (mBlink != null) {
            mBlink.cancel();
        }

        if (mInsertionPointCursorController != null) {
            mInsertionPointCursorController.onDetached();
        }

        if (mSelectionModifierCursorController != null) {
            mSelectionModifierCursorController.onDetached();
        }

        hideControllers();
    }

@@ -7718,6 +7730,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
         * @param event The touch 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 {
@@ -7995,12 +8014,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        public void hide() {
            mHandle.hide();
            TextView.this.removeCallbacks(mHider);
            removeCallbacks(mHider);
        }

        private void hideDelayed(int msec) {
            TextView.this.removeCallbacks(mHider);
            TextView.this.postDelayed(mHider, msec);
            removeCallbacks(mHider);
            postDelayed(mHider, msec);
        }

        public boolean isShowing() {
@@ -8040,6 +8059,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                hide();
            }
        }

        @Override
        public void onDetached() {
            removeCallbacks(mHider);
        }
    }

    private class SelectionModifierCursorController implements CursorController {
@@ -8197,6 +8221,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                hide();
            }
        }

        @Override
        public void onDetached() {
            removeCallbacks(mHider);
        }
    }

    private void hideInsertionPointCursorController() {