Merge "Fix issue #20679383: Add text style to assist.ViewNode..." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2d9c6015b3
@@ -36913,6 +36913,7 @@ package android.view {
|
||||
method public abstract void setText(java.lang.CharSequence);
|
||||
method public abstract void setText(java.lang.CharSequence, int, int);
|
||||
method public abstract void setTextPaint(android.text.TextPaint);
|
||||
method public abstract void setTextStyle(int, int, int, int);
|
||||
method public abstract void setVisibility(int);
|
||||
}
|
||||
|
||||
|
||||
@@ -39176,6 +39176,7 @@ package android.view {
|
||||
method public abstract void setText(java.lang.CharSequence);
|
||||
method public abstract void setText(java.lang.CharSequence, int, int);
|
||||
method public abstract void setTextPaint(android.text.TextPaint);
|
||||
method public abstract void setTextStyle(int, int, int, int);
|
||||
method public abstract void setVisibility(int);
|
||||
}
|
||||
|
||||
|
||||
@@ -634,6 +634,15 @@ final public class AssistStructure implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextStyle(int size, int fgColor, int bgColor, int style) {
|
||||
ViewNodeText t = getNodeText();
|
||||
t.mTextColor = fgColor;
|
||||
t.mTextBackgroundColor = bgColor;
|
||||
t.mTextSize = size;
|
||||
t.mTextStyle = style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHint(CharSequence hint) {
|
||||
getNodeText().mHint = hint != null ? hint.toString() : null;
|
||||
|
||||
@@ -25,60 +25,215 @@ import android.text.TextPaint;
|
||||
* View.onProvideStructure}.
|
||||
*/
|
||||
public abstract class ViewStructure {
|
||||
/**
|
||||
* Set the identifier for this view.
|
||||
*
|
||||
* @param id The view's identifier, as per {@link View#getId View.getId()}.
|
||||
* @param packageName The package name of the view's identifier, or null if there is none.
|
||||
* @param typeName The type name of the view's identifier, or null if there is none.
|
||||
* @param entryName The entry name of the view's identifier, or null if there is none.
|
||||
*/
|
||||
public abstract void setId(int id, String packageName, String typeName, String entryName);
|
||||
|
||||
/**
|
||||
* Set the basic dimensions of this view.
|
||||
*
|
||||
* @param left The view's left position, in pixels relative to its parent's left edge.
|
||||
* @param top The view's top position, in pixels relative to its parent's top edge.
|
||||
* @param scrollX How much the view's x coordinate space has been scrolled, in pixels.
|
||||
* @param scrollY How much the view's y coordinate space has been scrolled, in pixels.
|
||||
* @param width The view's visible width, in pixels. This is the width visible on screen,
|
||||
* not the total data width of a scrollable view.
|
||||
* @param height The view's visible height, in pixels. This is the height visible on
|
||||
* screen, not the total data height of a scrollable view.
|
||||
*/
|
||||
public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* Set the visibility state of this view, as per
|
||||
* {@link View#getVisibility View.getVisibility()}.
|
||||
*/
|
||||
public abstract void setVisibility(int visibility);
|
||||
|
||||
/** @hide */
|
||||
public abstract void setAssistBlocked(boolean state);
|
||||
|
||||
/**
|
||||
* Set the enabled state of this view, as per {@link View#isEnabled View.isEnabled()}.
|
||||
*/
|
||||
public abstract void setEnabled(boolean state);
|
||||
|
||||
/**
|
||||
* Set the clickable state of this view, as per {@link View#isClickable View.isClickable()}.
|
||||
*/
|
||||
public abstract void setClickable(boolean state);
|
||||
|
||||
/**
|
||||
* Set the long clickable state of this view, as per
|
||||
* {@link View#isLongClickable View.isLongClickable()}.
|
||||
*/
|
||||
public abstract void setLongClickable(boolean state);
|
||||
|
||||
/**
|
||||
* Set the stylus button pressable state of this view, as per
|
||||
* {@link View#isStylusButtonPressable View.isStylusButtonPressable()}.
|
||||
*/
|
||||
public abstract void setStylusButtonPressable(boolean state);
|
||||
|
||||
/**
|
||||
* Set the focusable state of this view, as per {@link View#isFocusable View.isFocusable()}.
|
||||
*/
|
||||
public abstract void setFocusable(boolean state);
|
||||
|
||||
/**
|
||||
* Set the focused state of this view, as per {@link View#isFocused View.isFocused()}.
|
||||
*/
|
||||
public abstract void setFocused(boolean state);
|
||||
|
||||
/**
|
||||
* Set the accessibility focused state of this view, as per
|
||||
* {@link View#isAccessibilityFocused View.isAccessibilityFocused()}.
|
||||
*/
|
||||
public abstract void setAccessibilityFocused(boolean state);
|
||||
|
||||
/**
|
||||
* Set the checkable state of this view, such as whether it implements the
|
||||
* {@link android.widget.Checkable} interface.
|
||||
*/
|
||||
public abstract void setCheckable(boolean state);
|
||||
|
||||
/**
|
||||
* Set the checked state of this view, such as
|
||||
* {@link android.widget.Checkable#isChecked Checkable.isChecked()}.
|
||||
*/
|
||||
public abstract void setChecked(boolean state);
|
||||
|
||||
/**
|
||||
* Set the selected state of this view, as per {@link View#isSelected View.isSelected()}.
|
||||
*/
|
||||
public abstract void setSelected(boolean state);
|
||||
|
||||
/**
|
||||
* Set the activated state of this view, as per {@link View#isActivated View.isActivated()}.
|
||||
*/
|
||||
public abstract void setActivated(boolean state);
|
||||
|
||||
/**
|
||||
* Set the class name of the view, as per
|
||||
* {@link View#getAccessibilityClassName View.getAccessibilityClassName()}.
|
||||
*/
|
||||
public abstract void setClassName(String className);
|
||||
|
||||
/**
|
||||
* Set the content description of the view, as per
|
||||
* {@link View#getContentDescription View.getContentDescription()}.
|
||||
*/
|
||||
public abstract void setContentDescription(CharSequence contentDescription);
|
||||
|
||||
/**
|
||||
* Set the text that is associated with this view. There is no selection
|
||||
* associated with the text. The text may have style spans to supply additional
|
||||
* display and semantic information.
|
||||
*/
|
||||
public abstract void setText(CharSequence text);
|
||||
|
||||
/**
|
||||
* Like {@link #setText(CharSequence)} but with an active selection
|
||||
* extending from <var>selectionStart</var> through <var>selectionEnd</var>.
|
||||
*/
|
||||
public abstract void setText(CharSequence text, int selectionStart, int selectionEnd);
|
||||
|
||||
/**
|
||||
* Set default global style of the text previously set with
|
||||
* {@link #setText}, derived from the given TextPaint object. Size, foreground color,
|
||||
* background color, and style information will be extracted from the paint.
|
||||
*/
|
||||
public abstract void setTextPaint(TextPaint paint);
|
||||
|
||||
/**
|
||||
* Explicitly set default global style information for text that was previously set with
|
||||
* {@link #setText}.
|
||||
*
|
||||
* @param size The size, in pixels, of the text.
|
||||
* @param fgColor The foreground color, packed as 0xAARRGGBB.
|
||||
* @param bgColor The background color, packed as 0xAARRGGBB.
|
||||
* @param style Style flags, as defined by {@link android.app.AssistStructure.ViewNode}.
|
||||
*/
|
||||
public abstract void setTextStyle(int size, int fgColor, int bgColor, int style);
|
||||
|
||||
/**
|
||||
* Set optional hint text associated with this view; this is for example the text that is
|
||||
* shown by an EditText when it is empty to indicate to the user the kind of text to input.
|
||||
*/
|
||||
public abstract void setHint(CharSequence hint);
|
||||
|
||||
/**
|
||||
* Retrieve the last {@link #setText(CharSequence)}.
|
||||
*/
|
||||
public abstract CharSequence getText();
|
||||
|
||||
/**
|
||||
* Retrieve the last selection start set by {@link #setText(CharSequence, int, int)}.
|
||||
*/
|
||||
public abstract int getTextSelectionStart();
|
||||
|
||||
/**
|
||||
* Retrieve the last selection end set by {@link #setText(CharSequence, int, int)}.
|
||||
*/
|
||||
public abstract int getTextSelectionEnd();
|
||||
|
||||
/**
|
||||
* Retrieve the last hint set by {@link #setHint}.
|
||||
*/
|
||||
public abstract CharSequence getHint();
|
||||
|
||||
/**
|
||||
* Get extra data associated with this view structure; the returned Bundle is mutable,
|
||||
* allowing you to view and modify its contents. Keys placed in the Bundle should use
|
||||
* an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conflicts.
|
||||
*/
|
||||
public abstract Bundle getExtras();
|
||||
|
||||
/**
|
||||
* Returns true if {@link #getExtras} has been used to create extra content.
|
||||
*/
|
||||
public abstract boolean hasExtras();
|
||||
|
||||
/**
|
||||
* Set the number of children of this view, which defines the range of indices you can
|
||||
* use with {@link #newChild} and {@link #asyncNewChild}. Calling this method again
|
||||
* resets all of the child state of the view, removing any children that had previously
|
||||
* been added.
|
||||
*/
|
||||
public abstract void setChildCount(int num);
|
||||
|
||||
/**
|
||||
* Return the child count as set by {@link #setChildCount}.
|
||||
*/
|
||||
public abstract int getChildCount();
|
||||
|
||||
/**
|
||||
* Create a new child {@link ViewStructure} in this view, putting into the list of
|
||||
* children at <var>index</var>.
|
||||
* @return Returns an fresh {@link ViewStructure} ready to be filled in.
|
||||
*/
|
||||
public abstract ViewAssistStructure newChild(int index);
|
||||
|
||||
/**
|
||||
* Like {@link #newChild}, but allows the caller to asynchronously populate the returned
|
||||
* child. It can transfer the returned {@link ViewStructure} to another thread for it
|
||||
* to build its content (and children etc). Once done, some thread must call
|
||||
* {@link #asyncCommit} to tell the containing {@link ViewStructure} that the async
|
||||
* population is done.
|
||||
* @return Returns an fresh {@link ViewStructure} ready to be filled in.
|
||||
*/
|
||||
public abstract ViewAssistStructure asyncNewChild(int index);
|
||||
|
||||
/**
|
||||
* Call when done populating a {@link ViewStructure} returned by
|
||||
* {@link #asyncNewChild}.
|
||||
*/
|
||||
public abstract void asyncCommit();
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -136,6 +136,11 @@ public class ViewAssistStructure extends android.view.ViewAssistStructure {
|
||||
mV.setTextPaint(paint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextStyle(int size, int fgColor, int bgColor, int style) {
|
||||
mV.setTextStyle(size, fgColor, bgColor, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHint(CharSequence hint) {
|
||||
mV.setHint(hint);
|
||||
|
||||
Reference in New Issue
Block a user