Merge "docs: Edited API documentation related to line-break and line-break word styles." into tm-dev

This commit is contained in:
Jon Eckenrode
2022-08-25 18:35:40 +00:00
committed by Android (Google) Code Review
2 changed files with 46 additions and 33 deletions

View File

@@ -4877,20 +4877,28 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Set the line break style for text wrapping. * Sets the line-break style for text wrapping.
* *
* The line break style to indicates the line break strategies can be used when * <p>Line-break style specifies the line-break strategies that can be used
* calculating the text wrapping. The line break style affects rule-based breaking. It * for text wrapping. The line-break style affects rule-based line breaking
* specifies the strictness of line-breaking rules. * by specifying the strictness of line-breaking rules.
* There are several types for the line break style:
* {@link LineBreakConfig#LINE_BREAK_STYLE_LOOSE},
* {@link LineBreakConfig#LINE_BREAK_STYLE_NORMAL} and
* {@link LineBreakConfig#LINE_BREAK_STYLE_STRICT}. The default values of the line break style
* is {@link LineBreakConfig#LINE_BREAK_STYLE_NONE}, indicating no breaking rule is specified.
* See <a href="https://www.w3.org/TR/css-text-3/#line-break-property">
* the line-break property</a>
* *
* @param lineBreakStyle the line break style for the text. * <p>The following are types of line-break styles:
* <ul>
* <li>{@link LineBreakConfig#LINE_BREAK_STYLE_LOOSE}
* <li>{@link LineBreakConfig#LINE_BREAK_STYLE_NORMAL}
* <li>{@link LineBreakConfig#LINE_BREAK_STYLE_STRICT}
* </ul>
*
* <p>The default line-break style is
* {@link LineBreakConfig#LINE_BREAK_STYLE_NONE}, which specifies that no
* line-breaking rules are used.
*
* <p>See the
* <a href="https://www.w3.org/TR/css-text-3/#line-break-property" class="external">
* line-break property</a> for more information.
*
* @param lineBreakStyle The line-break style for the text.
*/ */
public void setLineBreakStyle(@LineBreakConfig.LineBreakStyle int lineBreakStyle) { public void setLineBreakStyle(@LineBreakConfig.LineBreakStyle int lineBreakStyle) {
if (mLineBreakStyle != lineBreakStyle) { if (mLineBreakStyle != lineBreakStyle) {
@@ -4904,17 +4912,22 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Set the line break word style for text wrapping. * Sets the line-break word style for text wrapping.
* *
* The line break word style affects dictionary-based breaking and provide phrase-based * <p>The line-break word style affects dictionary-based line breaking by
* breaking opportunities. The type for the line break word style is * providing phrase-based line-breaking opportunities. Use
* {@link LineBreakConfig#LINE_BREAK_WORD_STYLE_PHRASE}. The default values of the line break * {@link LineBreakConfig#LINE_BREAK_WORD_STYLE_PHRASE} to specify
* word style is {@link LineBreakConfig#LINE_BREAK_WORD_STYLE_NONE}, indicating no breaking rule * phrase-based line breaking.
* is specified.
* See <a href="https://www.w3.org/TR/css-text-3/#word-break-property">
* the word-break property</a>
* *
* @param lineBreakWordStyle the line break word style for the tet * <p>The default line-break word style is
* {@link LineBreakConfig#LINE_BREAK_WORD_STYLE_NONE}, which specifies that
* no line-breaking word style is used.
*
* <p>See the
* <a href="https://www.w3.org/TR/css-text-3/#word-break-property" class="external">
* word-break property</a> for more information.
*
* @param lineBreakWordStyle The line-break word style for the text.
*/ */
public void setLineBreakWordStyle(@LineBreakConfig.LineBreakWordStyle int lineBreakWordStyle) { public void setLineBreakWordStyle(@LineBreakConfig.LineBreakWordStyle int lineBreakWordStyle) {
if (mLineBreakWordStyle != lineBreakWordStyle) { if (mLineBreakWordStyle != lineBreakWordStyle) {
@@ -4928,18 +4941,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Get the current line break style for text wrapping. * Gets the current line-break style for text wrapping.
* *
* @return the current line break style to be used for text wrapping. * @return The line-break style to be used for text wrapping.
*/ */
public @LineBreakConfig.LineBreakStyle int getLineBreakStyle() { public @LineBreakConfig.LineBreakStyle int getLineBreakStyle() {
return mLineBreakStyle; return mLineBreakStyle;
} }
/** /**
* Get the current line word break style for text wrapping. * Gets the current line-break word style for text wrapping.
* *
* @return the current line break word style to be used for text wrapping. * @return The line-break word style to be used for text wrapping.
*/ */
public @LineBreakConfig.LineBreakWordStyle int getLineBreakWordStyle() { public @LineBreakConfig.LineBreakWordStyle int getLineBreakWordStyle() {
return mLineBreakWordStyle; return mLineBreakWordStyle;

View File

@@ -5475,22 +5475,22 @@
ignores some hyphen character related typographic features, e.g. kerning. --> ignores some hyphen character related typographic features, e.g. kerning. -->
<enum name="fullFast" value="4" /> <enum name="fullFast" value="4" />
</attr> </attr>
<!-- Indicates the line break strategies can be used when calculating the text wrapping. --> <!-- Specifies the line-break strategies for text wrapping. -->
<attr name="lineBreakStyle"> <attr name="lineBreakStyle">
<!-- No line break style specific. --> <!-- No line-break rules are used for line breaking. -->
<enum name="none" value="0" /> <enum name="none" value="0" />
<!-- Use the least restrictive rule for line-breaking. --> <!-- The least restrictive line-break rules are used for line breaking. -->
<enum name="loose" value="1" /> <enum name="loose" value="1" />
<!-- Indicates breaking text with the most comment set of line-breaking rules. --> <!-- The most common line-break rules are used for line breaking. -->
<enum name="normal" value="2" /> <enum name="normal" value="2" />
<!-- Indicates breaking text with the most strictest line-breaking rules. --> <!-- The most strict line-break rules are used for line breaking. -->
<enum name="strict" value="3" /> <enum name="strict" value="3" />
</attr> </attr>
<!-- Specify the phrase-based line break can be used when calculating the text wrapping.--> <!-- Specifies the line-break word strategies for text wrapping.-->
<attr name="lineBreakWordStyle"> <attr name="lineBreakWordStyle">
<!-- No line break word style specific. --> <!-- No line-break word style is used for line breaking. -->
<enum name="none" value="0" /> <enum name="none" value="0" />
<!-- Specify the phrase based breaking. --> <!-- Line breaking is based on phrases, which results in text wrapping only on meaningful words. -->
<enum name="phrase" value="1" /> <enum name="phrase" value="1" />
</attr> </attr>
<!-- Specify the type of auto-size. Note that this feature is not supported by EditText, <!-- Specify the type of auto-size. Note that this feature is not supported by EditText,