Merge "Fix cursor not blinking when view re-added to layout" am: 8412b132c7 am: 9f93d0220b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2553130 Change-Id: I432148bb839600a974e0b57e799c65e02413da7c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -709,7 +709,10 @@ public class Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPositionListener().addSubscriber(mCursorAnchorInfoNotifier, true);
|
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() {
|
void onDetachedFromWindow() {
|
||||||
@@ -1081,8 +1084,10 @@ public class Editor {
|
|||||||
private void resumeBlink() {
|
private void resumeBlink() {
|
||||||
if (mBlink != null) {
|
if (mBlink != null) {
|
||||||
mBlink.uncancel();
|
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,
|
void adjustInputType(boolean password, boolean passwordInputType,
|
||||||
@@ -2862,6 +2867,9 @@ public class Editor {
|
|||||||
if (shouldBlink()) {
|
if (shouldBlink()) {
|
||||||
mShowCursor = SystemClock.uptimeMillis();
|
mShowCursor = SystemClock.uptimeMillis();
|
||||||
if (mBlink == null) mBlink = new Blink();
|
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.removeCallbacks(mBlink);
|
||||||
mTextView.postDelayed(mBlink, BLINK);
|
mTextView.postDelayed(mBlink, BLINK);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user