summaryrefslogtreecommitdiff
path: root/graphics/java/android
diff options
context:
space:
mode:
author Seigo Nonaka <nona@google.com> 2024-05-20 15:03:50 +0900
committer Seigo Nonaka <nona@google.com> 2024-05-20 12:46:55 +0000
commitaf9f831a6cd09eb76cb9e05270a8b8f986e07f75 (patch)
treeb9b9f73d51d503bd2460c50004972045b17cb8a6 /graphics/java/android
parent05d6a12436e1cc9aff2ffc87cdc12f80de1e6cf1 (diff)
Add getter methods to the line breaker
Flag: com.android.text.flags.missing_getter_apis Bug: 340875345 Test: m checkapi Change-Id: Ifc51bbfc0ab36d76321efaa5beb74992b0a7c246
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/text/LineBreaker.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/text/LineBreaker.java b/graphics/java/android/graphics/text/LineBreaker.java
index d8cf21e72441..94de066c9182 100644
--- a/graphics/java/android/graphics/text/LineBreaker.java
+++ b/graphics/java/android/graphics/text/LineBreaker.java
@@ -18,6 +18,8 @@ package android.graphics.text;
import static com.android.text.flags.Flags.FLAG_USE_BOUNDS_FOR_WIDTH;
import static com.android.text.flags.Flags.FLAG_LETTER_SPACING_JUSTIFICATION;
+import static com.android.text.flags.Flags.FLAG_MISSING_GETTER_APIS;
+
import android.annotation.FlaggedApi;
import android.annotation.FloatRange;
@@ -488,6 +490,12 @@ public class LineBreaker {
private final long mNativePtr;
+ private final @BreakStrategy int mBreakStrategy;
+ private final @HyphenationFrequency int mHyphenationFrequency;
+ private final @JustificationMode int mJustificationMode;
+ private final int[] mIndents;
+ private final boolean mUseBoundsForWidth;
+
/**
* Use Builder instead.
*/
@@ -497,6 +505,67 @@ public class LineBreaker {
mNativePtr = nInit(breakStrategy, hyphenationFrequency,
justify == JUSTIFICATION_MODE_INTER_WORD, indents, useBoundsForWidth);
NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mNativePtr);
+
+ mBreakStrategy = breakStrategy;
+ mHyphenationFrequency = hyphenationFrequency;
+ mJustificationMode = justify;
+ mIndents = indents;
+ mUseBoundsForWidth = useBoundsForWidth;
+ }
+
+ /**
+ * Returns the break strategy used for this line breaker.
+ *
+ * @return the break strategy used for this line breaker.
+ * @see Builder#setBreakStrategy(int)
+ */
+ @FlaggedApi(FLAG_MISSING_GETTER_APIS)
+ public @BreakStrategy int getBreakStrategy() {
+ return mBreakStrategy;
+ }
+
+ /**
+ * Returns the hyphenation frequency used for this line breaker.
+ *
+ * @return the hyphenation frequency used for this line breaker.
+ * @see Builder#setHyphenationFrequency(int)
+ */
+ @FlaggedApi(FLAG_MISSING_GETTER_APIS)
+ public @HyphenationFrequency int getHyphenationFrequency() {
+ return mHyphenationFrequency;
+ }
+
+ /**
+ * Returns the justification mode used for this line breaker.
+ *
+ * @return the justification mode used for this line breaker.
+ * @see Builder#setJustificationMode(int)
+ */
+ @FlaggedApi(FLAG_MISSING_GETTER_APIS)
+ public @JustificationMode int getJustificationMode() {
+ return mJustificationMode;
+ }
+
+ /**
+ * Returns the indents used for this line breaker.
+ *
+ * @return the indents used for this line breaker.
+ * @see Builder#setIndents(int[])
+ */
+ @FlaggedApi(FLAG_MISSING_GETTER_APIS)
+ public @Nullable int[] getIndents() {
+ return mIndents;
+ }
+
+ /**
+ * Returns true if this line breaker uses bounds as width for line breaking.
+ *
+ * @return true if this line breaker uses bounds as width for line breaking.
+ * @see Builder#setUseBoundsForWidth(boolean)
+ */
+ @FlaggedApi(FLAG_MISSING_GETTER_APIS)
+ public boolean getUseBoundsForWidth() {
+ return mUseBoundsForWidth;
}
/**