Loading core/api/current.txt +33 −0 Original line number Original line Diff line number Diff line Loading @@ -45193,6 +45193,14 @@ package android.text { method public void getChars(int, int, char[], int); method public void getChars(int, int, char[], int); } } public class GraphemeClusterSegmentFinder extends android.text.SegmentFinder { ctor public GraphemeClusterSegmentFinder(@NonNull CharSequence, @NonNull android.text.TextPaint); method public int nextEndBoundary(@IntRange(from=0) int); method public int nextStartBoundary(@IntRange(from=0) int); method public int previousEndBoundary(@IntRange(from=0) int); method public int previousStartBoundary(@IntRange(from=0) int); } public class Html { public class Html { method public static String escapeHtml(CharSequence); method public static String escapeHtml(CharSequence); method @Deprecated public static android.text.Spanned fromHtml(String); method @Deprecated public static android.text.Spanned fromHtml(String); Loading Loading @@ -45322,6 +45330,7 @@ package android.text { method public final int getParagraphLeft(int); method public final int getParagraphLeft(int); method public final int getParagraphRight(int); method public final int getParagraphRight(int); method public float getPrimaryHorizontal(int); method public float getPrimaryHorizontal(int); method @Nullable public int[] getRangeForRect(@NonNull android.graphics.RectF, @NonNull android.text.SegmentFinder, @NonNull android.text.Layout.TextInclusionStrategy); method public float getSecondaryHorizontal(int); method public float getSecondaryHorizontal(int); method public void getSelectionPath(int, int, android.graphics.Path); method public void getSelectionPath(int, int, android.graphics.Path); method public final float getSpacingAdd(); method public final float getSpacingAdd(); Loading @@ -45345,6 +45354,9 @@ package android.text { field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0 field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0 field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1 field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1 field public static final int HYPHENATION_FREQUENCY_NORMAL_FAST = 3; // 0x3 field public static final int HYPHENATION_FREQUENCY_NORMAL_FAST = 3; // 0x3 field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP; field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL; field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER; field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1 field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1 field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0 field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0 } } Loading @@ -45358,6 +45370,10 @@ package android.text { public static class Layout.Directions { public static class Layout.Directions { } } @java.lang.FunctionalInterface public static interface Layout.TextInclusionStrategy { method public boolean isSegmentInside(@NonNull android.graphics.RectF, @NonNull android.graphics.RectF); } @Deprecated public abstract class LoginFilter implements android.text.InputFilter { @Deprecated public abstract class LoginFilter implements android.text.InputFilter { method @Deprecated public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method @Deprecated public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method @Deprecated public abstract boolean isAllowed(char); method @Deprecated public abstract boolean isAllowed(char); Loading Loading @@ -45434,6 +45450,15 @@ package android.text { method public android.text.PrecomputedText.Params.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic); method public android.text.PrecomputedText.Params.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic); } } public abstract class SegmentFinder { ctor public SegmentFinder(); method public abstract int nextEndBoundary(@IntRange(from=0) int); method public abstract int nextStartBoundary(@IntRange(from=0) int); method public abstract int previousEndBoundary(@IntRange(from=0) int); method public abstract int previousStartBoundary(@IntRange(from=0) int); field public static final int DONE = -1; // 0xffffffff } public class Selection { public class Selection { method public static boolean extendDown(android.text.Spannable, android.text.Layout); method public static boolean extendDown(android.text.Spannable, android.text.Layout); method public static boolean extendLeft(android.text.Spannable, android.text.Layout); method public static boolean extendLeft(android.text.Spannable, android.text.Layout); Loading Loading @@ -45719,6 +45744,14 @@ package android.text { method public void onTextChanged(CharSequence, int, int, int); method public void onTextChanged(CharSequence, int, int, int); } } public class WordSegmentFinder extends android.text.SegmentFinder { ctor public WordSegmentFinder(@NonNull CharSequence, @NonNull java.util.Locale); method public int nextEndBoundary(@IntRange(from=0) int); method public int nextStartBoundary(@IntRange(from=0) int); method public int previousEndBoundary(@IntRange(from=0) int); method public int previousStartBoundary(@IntRange(from=0) int); } } } package android.text.format { package android.text.format { core/java/android/text/GraphemeClusterSegmentFinder.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,11 @@ import android.graphics.Paint; * Implementation of {@code SegmentFinder} using grapheme clusters as the text segment. Whitespace * Implementation of {@code SegmentFinder} using grapheme clusters as the text segment. Whitespace * characters are included as segments. * characters are included as segments. * * * @hide * <p>For example, the text "a pot" would be divided into five text segments: "a", " ", "p", "o", * "t". * * @see <a href="https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries">Unicode Text * Segmentation - Grapheme Cluster Boundaries</a> */ */ public class GraphemeClusterSegmentFinder extends SegmentFinder { public class GraphemeClusterSegmentFinder extends SegmentFinder { private final CharSequence mText; private final CharSequence mText; Loading core/java/android/text/Layout.java +1 −9 Original line number Original line Diff line number Diff line Loading @@ -170,8 +170,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * intersect the rectangle. * intersect the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP = public static final TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP = Loading @@ -180,8 +178,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the center of the * Strategy which considers a text segment to be inside a rectangle area if the center of the * segment bounds is inside the rectangle. * segment bounds is inside the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER = public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER = Loading @@ -191,8 +187,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * are completely contained within the rectangle. * are completely contained within the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL = public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL = Loading Loading @@ -1867,7 +1861,6 @@ public abstract class Layout { * specified area * specified area * @return int array of size 2 containing the start (inclusive) and end (exclusive) character * @return int array of size 2 containing the start (inclusive) and end (exclusive) character * offsets of the range, or null if there are no text segments inside the area * offsets of the range, or null if there are no text segments inside the area * @hide */ */ @Nullable @Nullable public int[] getRangeForRect(@NonNull RectF area, @NonNull SegmentFinder segmentFinder, public int[] getRangeForRect(@NonNull RectF area, @NonNull SegmentFinder segmentFinder, Loading Loading @@ -3215,8 +3208,7 @@ public abstract class Layout { /** /** * Strategy for determining whether a text segment is inside a rectangle area. * Strategy for determining whether a text segment is inside a rectangle area. * * * @see #getRangeForRect(RectF, SegmentIterator, TextInclusionStrategy) * @see #getRangeForRect(RectF, SegmentFinder, TextInclusionStrategy) * @hide */ */ @FunctionalInterface @FunctionalInterface public interface TextInclusionStrategy { public interface TextInclusionStrategy { Loading core/java/android/text/SegmentFinder.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -17,19 +17,20 @@ package android.text; package android.text; import android.annotation.IntRange; import android.annotation.IntRange; import android.graphics.RectF; /** /** * Finds text segment boundaries within text. Subclasses can implement different types of text * Finds text segment boundaries within text. Subclasses can implement different types of text * segments. Grapheme clusters and words are examples of possible text segments. * segments. Grapheme clusters and words are examples of possible text segments. These are * implemented by {@link GraphemeClusterSegmentFinder} and {@link WordSegmentFinder}. * * * <p>Text segments may not overlap, so every character belongs to at most one text segment. A * <p>Text segments may not overlap, so every character belongs to at most one text segment. A * character may belong to no text segments. * character may belong to no text segments. * * * <p>For example, a word level text segment finder may subdivide the text "Hello, World!" into four * <p>For example, WordSegmentFinder subdivides the text "Hello, World!" into four text segments: * text segments: "Hello", ",", "World", "!". The space character does not belong to any text * "Hello", ",", "World", "!". The space character does not belong to any text segments. * segments. * * * @hide * @see Layout#getRangeForRect(RectF, SegmentFinder, Layout.TextInclusionStrategy) */ */ public abstract class SegmentFinder { public abstract class SegmentFinder { public static final int DONE = -1; public static final int DONE = -1; Loading core/java/android/text/WordSegmentFinder.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -18,20 +18,35 @@ package android.text; import android.annotation.IntRange; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.SuppressLint; import android.icu.text.BreakIterator; import android.icu.text.BreakIterator; import android.text.method.WordIterator; import android.text.method.WordIterator; import java.util.Locale; /** /** * Implementation of {@code SegmentFinder} using words as the text segment. Word boundaries are * Implementation of {@link SegmentFinder} using words as the text segment. Word boundaries are * found using {@code WordIterator}. Whitespace characters are excluded, so they are not included in * found using {@link WordIterator}. Whitespace characters are excluded, so they are not included in * any text segments. * any text segments. * * * @hide * <p>For example, the text "Hello, World!" would be subdivided into four text segments: "Hello", * ",", "World", "!". The space character does not belong to any text segments. * * @see <a href="https://unicode.org/reports/tr29/#Word_Boundaries">Unicode Text Segmentation - Word * Boundaries</a> */ */ public class WordSegmentFinder extends SegmentFinder { public class WordSegmentFinder extends SegmentFinder { private final CharSequence mText; private final CharSequence mText; private final WordIterator mWordIterator; private final WordIterator mWordIterator; public WordSegmentFinder( @NonNull CharSequence text, @SuppressLint("UseIcu") @NonNull Locale locale) { mText = text; mWordIterator = new WordIterator(locale); mWordIterator.setCharSequence(text, 0, text.length()); } /** @hide */ public WordSegmentFinder(@NonNull CharSequence text, @NonNull WordIterator wordIterator) { public WordSegmentFinder(@NonNull CharSequence text, @NonNull WordIterator wordIterator) { mText = text; mText = text; mWordIterator = wordIterator; mWordIterator = wordIterator; Loading Loading
core/api/current.txt +33 −0 Original line number Original line Diff line number Diff line Loading @@ -45193,6 +45193,14 @@ package android.text { method public void getChars(int, int, char[], int); method public void getChars(int, int, char[], int); } } public class GraphemeClusterSegmentFinder extends android.text.SegmentFinder { ctor public GraphemeClusterSegmentFinder(@NonNull CharSequence, @NonNull android.text.TextPaint); method public int nextEndBoundary(@IntRange(from=0) int); method public int nextStartBoundary(@IntRange(from=0) int); method public int previousEndBoundary(@IntRange(from=0) int); method public int previousStartBoundary(@IntRange(from=0) int); } public class Html { public class Html { method public static String escapeHtml(CharSequence); method public static String escapeHtml(CharSequence); method @Deprecated public static android.text.Spanned fromHtml(String); method @Deprecated public static android.text.Spanned fromHtml(String); Loading Loading @@ -45322,6 +45330,7 @@ package android.text { method public final int getParagraphLeft(int); method public final int getParagraphLeft(int); method public final int getParagraphRight(int); method public final int getParagraphRight(int); method public float getPrimaryHorizontal(int); method public float getPrimaryHorizontal(int); method @Nullable public int[] getRangeForRect(@NonNull android.graphics.RectF, @NonNull android.text.SegmentFinder, @NonNull android.text.Layout.TextInclusionStrategy); method public float getSecondaryHorizontal(int); method public float getSecondaryHorizontal(int); method public void getSelectionPath(int, int, android.graphics.Path); method public void getSelectionPath(int, int, android.graphics.Path); method public final float getSpacingAdd(); method public final float getSpacingAdd(); Loading @@ -45345,6 +45354,9 @@ package android.text { field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0 field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0 field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1 field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1 field public static final int HYPHENATION_FREQUENCY_NORMAL_FAST = 3; // 0x3 field public static final int HYPHENATION_FREQUENCY_NORMAL_FAST = 3; // 0x3 field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP; field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL; field @NonNull public static final android.text.Layout.TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER; field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1 field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1 field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0 field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0 } } Loading @@ -45358,6 +45370,10 @@ package android.text { public static class Layout.Directions { public static class Layout.Directions { } } @java.lang.FunctionalInterface public static interface Layout.TextInclusionStrategy { method public boolean isSegmentInside(@NonNull android.graphics.RectF, @NonNull android.graphics.RectF); } @Deprecated public abstract class LoginFilter implements android.text.InputFilter { @Deprecated public abstract class LoginFilter implements android.text.InputFilter { method @Deprecated public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method @Deprecated public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method @Deprecated public abstract boolean isAllowed(char); method @Deprecated public abstract boolean isAllowed(char); Loading Loading @@ -45434,6 +45450,15 @@ package android.text { method public android.text.PrecomputedText.Params.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic); method public android.text.PrecomputedText.Params.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic); } } public abstract class SegmentFinder { ctor public SegmentFinder(); method public abstract int nextEndBoundary(@IntRange(from=0) int); method public abstract int nextStartBoundary(@IntRange(from=0) int); method public abstract int previousEndBoundary(@IntRange(from=0) int); method public abstract int previousStartBoundary(@IntRange(from=0) int); field public static final int DONE = -1; // 0xffffffff } public class Selection { public class Selection { method public static boolean extendDown(android.text.Spannable, android.text.Layout); method public static boolean extendDown(android.text.Spannable, android.text.Layout); method public static boolean extendLeft(android.text.Spannable, android.text.Layout); method public static boolean extendLeft(android.text.Spannable, android.text.Layout); Loading Loading @@ -45719,6 +45744,14 @@ package android.text { method public void onTextChanged(CharSequence, int, int, int); method public void onTextChanged(CharSequence, int, int, int); } } public class WordSegmentFinder extends android.text.SegmentFinder { ctor public WordSegmentFinder(@NonNull CharSequence, @NonNull java.util.Locale); method public int nextEndBoundary(@IntRange(from=0) int); method public int nextStartBoundary(@IntRange(from=0) int); method public int previousEndBoundary(@IntRange(from=0) int); method public int previousStartBoundary(@IntRange(from=0) int); } } } package android.text.format { package android.text.format {
core/java/android/text/GraphemeClusterSegmentFinder.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,11 @@ import android.graphics.Paint; * Implementation of {@code SegmentFinder} using grapheme clusters as the text segment. Whitespace * Implementation of {@code SegmentFinder} using grapheme clusters as the text segment. Whitespace * characters are included as segments. * characters are included as segments. * * * @hide * <p>For example, the text "a pot" would be divided into five text segments: "a", " ", "p", "o", * "t". * * @see <a href="https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries">Unicode Text * Segmentation - Grapheme Cluster Boundaries</a> */ */ public class GraphemeClusterSegmentFinder extends SegmentFinder { public class GraphemeClusterSegmentFinder extends SegmentFinder { private final CharSequence mText; private final CharSequence mText; Loading
core/java/android/text/Layout.java +1 −9 Original line number Original line Diff line number Diff line Loading @@ -170,8 +170,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * intersect the rectangle. * intersect the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP = public static final TextInclusionStrategy INCLUSION_STRATEGY_ANY_OVERLAP = Loading @@ -180,8 +178,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the center of the * Strategy which considers a text segment to be inside a rectangle area if the center of the * segment bounds is inside the rectangle. * segment bounds is inside the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER = public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_CENTER = Loading @@ -191,8 +187,6 @@ public abstract class Layout { /** /** * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * Strategy which considers a text segment to be inside a rectangle area if the segment bounds * are completely contained within the rectangle. * are completely contained within the rectangle. * * @hide */ */ @NonNull @NonNull public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL = public static final TextInclusionStrategy INCLUSION_STRATEGY_CONTAINS_ALL = Loading Loading @@ -1867,7 +1861,6 @@ public abstract class Layout { * specified area * specified area * @return int array of size 2 containing the start (inclusive) and end (exclusive) character * @return int array of size 2 containing the start (inclusive) and end (exclusive) character * offsets of the range, or null if there are no text segments inside the area * offsets of the range, or null if there are no text segments inside the area * @hide */ */ @Nullable @Nullable public int[] getRangeForRect(@NonNull RectF area, @NonNull SegmentFinder segmentFinder, public int[] getRangeForRect(@NonNull RectF area, @NonNull SegmentFinder segmentFinder, Loading Loading @@ -3215,8 +3208,7 @@ public abstract class Layout { /** /** * Strategy for determining whether a text segment is inside a rectangle area. * Strategy for determining whether a text segment is inside a rectangle area. * * * @see #getRangeForRect(RectF, SegmentIterator, TextInclusionStrategy) * @see #getRangeForRect(RectF, SegmentFinder, TextInclusionStrategy) * @hide */ */ @FunctionalInterface @FunctionalInterface public interface TextInclusionStrategy { public interface TextInclusionStrategy { Loading
core/java/android/text/SegmentFinder.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -17,19 +17,20 @@ package android.text; package android.text; import android.annotation.IntRange; import android.annotation.IntRange; import android.graphics.RectF; /** /** * Finds text segment boundaries within text. Subclasses can implement different types of text * Finds text segment boundaries within text. Subclasses can implement different types of text * segments. Grapheme clusters and words are examples of possible text segments. * segments. Grapheme clusters and words are examples of possible text segments. These are * implemented by {@link GraphemeClusterSegmentFinder} and {@link WordSegmentFinder}. * * * <p>Text segments may not overlap, so every character belongs to at most one text segment. A * <p>Text segments may not overlap, so every character belongs to at most one text segment. A * character may belong to no text segments. * character may belong to no text segments. * * * <p>For example, a word level text segment finder may subdivide the text "Hello, World!" into four * <p>For example, WordSegmentFinder subdivides the text "Hello, World!" into four text segments: * text segments: "Hello", ",", "World", "!". The space character does not belong to any text * "Hello", ",", "World", "!". The space character does not belong to any text segments. * segments. * * * @hide * @see Layout#getRangeForRect(RectF, SegmentFinder, Layout.TextInclusionStrategy) */ */ public abstract class SegmentFinder { public abstract class SegmentFinder { public static final int DONE = -1; public static final int DONE = -1; Loading
core/java/android/text/WordSegmentFinder.java +18 −3 Original line number Original line Diff line number Diff line Loading @@ -18,20 +18,35 @@ package android.text; import android.annotation.IntRange; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.SuppressLint; import android.icu.text.BreakIterator; import android.icu.text.BreakIterator; import android.text.method.WordIterator; import android.text.method.WordIterator; import java.util.Locale; /** /** * Implementation of {@code SegmentFinder} using words as the text segment. Word boundaries are * Implementation of {@link SegmentFinder} using words as the text segment. Word boundaries are * found using {@code WordIterator}. Whitespace characters are excluded, so they are not included in * found using {@link WordIterator}. Whitespace characters are excluded, so they are not included in * any text segments. * any text segments. * * * @hide * <p>For example, the text "Hello, World!" would be subdivided into four text segments: "Hello", * ",", "World", "!". The space character does not belong to any text segments. * * @see <a href="https://unicode.org/reports/tr29/#Word_Boundaries">Unicode Text Segmentation - Word * Boundaries</a> */ */ public class WordSegmentFinder extends SegmentFinder { public class WordSegmentFinder extends SegmentFinder { private final CharSequence mText; private final CharSequence mText; private final WordIterator mWordIterator; private final WordIterator mWordIterator; public WordSegmentFinder( @NonNull CharSequence text, @SuppressLint("UseIcu") @NonNull Locale locale) { mText = text; mWordIterator = new WordIterator(locale); mWordIterator.setCharSequence(text, 0, text.length()); } /** @hide */ public WordSegmentFinder(@NonNull CharSequence text, @NonNull WordIterator wordIterator) { public WordSegmentFinder(@NonNull CharSequence text, @NonNull WordIterator wordIterator) { mText = text; mText = text; mWordIterator = wordIterator; mWordIterator = wordIterator; Loading