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

Commit 084768d6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix cursor not blinking when view re-added to layout" am: 8412b132...

Merge "Fix cursor not blinking when view re-added to layout" am: 8412b132 am: 9f93d022 am: 832ebca8

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2553130



Change-Id: Ic9810fd7304dfbe00f5e4b1141fc31d006fe8bfc
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1de99f4d 832ebca8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -724,7 +724,10 @@ public class Editor {
        }

        getPositionListener().addSubscriber(mCursorAnchorInfoNotifier, true);
        makeBlink();
        // Call resumeBlink here instead of makeBlink to ensure that if mBlink is not null the
        // Blink object is uncancelled.  This ensures when a view is removed and added back the
        // cursor will resume blinking.
        resumeBlink();
    }

    void onDetachedFromWindow() {
@@ -1094,8 +1097,10 @@ public class Editor {
    private void resumeBlink() {
        if (mBlink != null) {
            mBlink.uncancel();
            makeBlink();
        }
        // Moving makeBlink outside of the null check block ensures that mBlink object gets
        // instantiated when the view is added to the window if mBlink is still null.
        makeBlink();
    }

    void adjustInputType(boolean password, boolean passwordInputType,
@@ -2921,6 +2926,9 @@ public class Editor {
        if (shouldBlink()) {
            mShowCursor = SystemClock.uptimeMillis();
            if (mBlink == null) mBlink = new Blink();
            // Call uncancel as mBlink could have previously been cancelled and cursor will not
            // resume blinking unless uncancelled.
            mBlink.uncancel();
            mTextView.removeCallbacks(mBlink);
            mTextView.postDelayed(mBlink, BLINK);
        } else {