Merge "Move cursor to end of text when autofilling." into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-07-27 04:21:31 +00:00
committed by Android (Google) Code Review

View File

@@ -10320,7 +10320,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return;
}
setText(value.getTextValue(), mBufferType, true, 0);
final CharSequence autofilledValue = value.getTextValue();
// First autofill it...
setText(autofilledValue, mBufferType, true, 0);
// ...then move cursor to the end.
final CharSequence text = getText();
if ((text instanceof Spannable)) {
Selection.setSelection((Spannable) text, text.length());
}
}
@Override