Merge "Add setTextAsync method to TextView" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c4c4796252
@@ -6938,11 +6938,25 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
* parameters used to create the PrecomputedText mismatches
|
* parameters used to create the PrecomputedText mismatches
|
||||||
* with this TextView.
|
* with this TextView.
|
||||||
*/
|
*/
|
||||||
@android.view.RemotableViewMethod
|
@android.view.RemotableViewMethod(asyncImpl = "setTextAsync")
|
||||||
public final void setText(CharSequence text) {
|
public final void setText(CharSequence text) {
|
||||||
setText(text, mBufferType);
|
setText(text, mBufferType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RemotableViewMethod's asyncImpl of {@link #setText(CharSequence)}.
|
||||||
|
* This should be called on a background thread, and returns a Runnable which is then must be
|
||||||
|
* called on the main thread to complete the operation and set text.
|
||||||
|
* @param text text to be displayed
|
||||||
|
* @return Runnable that sets text; must be called on the main thread by the caller of this
|
||||||
|
* method to complete the operation
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public Runnable setTextAsync(@Nullable CharSequence text) {
|
||||||
|
return () -> setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text to be displayed but retains the cursor position. Same as
|
* Sets the text to be displayed but retains the cursor position. Same as
|
||||||
* {@link #setText(CharSequence)} except that the cursor position (if any) is retained in the
|
* {@link #setText(CharSequence)} except that the cursor position (if any) is retained in the
|
||||||
|
|||||||
Reference in New Issue
Block a user