Skip to content

Commit d7c845c

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Make textDirection API public"
2 parents 43db1d9 + e7beae3 commit d7c845c

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

api/current.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ package android {
992992
field public static final int textColorTertiary = 16843282; // 0x1010212
993993
field public static final int textColorTertiaryInverse = 16843283; // 0x1010213
994994
field public static final int textCursorDrawable = 16843618; // 0x1010362
995+
field public static final int textDirection = 16843688; // 0x10103a8
995996
field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315
996997
field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
997998
field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
@@ -20478,6 +20479,19 @@ package android.text {
2047820479
method public int getTopPadding();
2047920480
}
2048020481

20482+
public abstract interface TextDirectionHeuristic {
20483+
}
20484+
20485+
public class TextDirectionHeuristics {
20486+
ctor public TextDirectionHeuristics();
20487+
field public static final android.text.TextDirectionHeuristic ANYRTL_LTR;
20488+
field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_LTR;
20489+
field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_RTL;
20490+
field public static final android.text.TextDirectionHeuristic LOCALE;
20491+
field public static final android.text.TextDirectionHeuristic LTR;
20492+
field public static final android.text.TextDirectionHeuristic RTL;
20493+
}
20494+
2048120495
public class TextPaint extends android.graphics.Paint {
2048220496
ctor public TextPaint();
2048320497
ctor public TextPaint(int);
@@ -23171,6 +23185,7 @@ package android.view {
2317123185
method public final android.view.ViewParent getParent();
2317223186
method public float getPivotX();
2317323187
method public float getPivotY();
23188+
method public int getResolvedTextDirection();
2317423189
method public android.content.res.Resources getResources();
2317523190
method public final int getRight();
2317623191
method protected float getRightFadingEdgeStrength();
@@ -23190,6 +23205,7 @@ package android.view {
2319023205
method public int getSystemUiVisibility();
2319123206
method public java.lang.Object getTag();
2319223207
method public java.lang.Object getTag(int);
23208+
method public int getTextDirection();
2319323209
method public final int getTop();
2319423210
method protected float getTopFadingEdgeStrength();
2319523211
method protected int getTopPaddingOffset();
@@ -23321,8 +23337,10 @@ package android.view {
2332123337
method public void requestLayout();
2332223338
method public boolean requestRectangleOnScreen(android.graphics.Rect);
2332323339
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
23340+
method protected void resetResolvedTextDirection();
2332423341
method public static int resolveSize(int, int);
2332523342
method public static int resolveSizeAndState(int, int, int);
23343+
method protected void resolveTextDirection();
2332623344
method public void restoreHierarchyState(android.util.SparseArray<android.os.Parcelable>);
2332723345
method public void saveHierarchyState(android.util.SparseArray<android.os.Parcelable>);
2332823346
method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
@@ -23402,6 +23420,7 @@ package android.view {
2340223420
method public void setSystemUiVisibility(int);
2340323421
method public void setTag(java.lang.Object);
2340423422
method public void setTag(int, java.lang.Object);
23423+
method public void setTextDirection(int);
2340523424
method public final void setTop(int);
2340623425
method public void setTouchDelegate(android.view.TouchDelegate);
2340723426
method public void setTranslationX(float);
@@ -23424,6 +23443,7 @@ package android.view {
2342423443
method public boolean willNotCacheDrawing();
2342523444
method public boolean willNotDraw();
2342623445
field public static final android.util.Property ALPHA;
23446+
field protected static int DEFAULT_TEXT_DIRECTION;
2342723447
field public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0
2342823448
field public static final int DRAWING_CACHE_QUALITY_HIGH = 1048576; // 0x100000
2342923449
field public static final int DRAWING_CACHE_QUALITY_LOW = 524288; // 0x80000
@@ -23500,6 +23520,12 @@ package android.view {
2350023520
field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2
2350123521
field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
2350223522
field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
23523+
field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2
23524+
field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1
23525+
field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0
23526+
field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5
23527+
field public static final int TEXT_DIRECTION_LTR = 3; // 0x3
23528+
field public static final int TEXT_DIRECTION_RTL = 4; // 0x4
2350323529
field public static final android.util.Property TRANSLATION_X;
2350423530
field public static final android.util.Property TRANSLATION_Y;
2350523531
field protected static final java.lang.String VIEW_LOG_TAG = "View";
@@ -23766,7 +23792,6 @@ package android.view {
2376623792
method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
2376723793
method public void requestTransparentRegion(android.view.View);
2376823794
method protected void resetResolvedLayoutDirection();
23769-
method protected void resetResolvedTextDirection();
2377023795
method public void scheduleLayoutAnimation();
2377123796
method public void setAddStatesFromChildren(boolean);
2377223797
method public void setAlwaysDrawnWithCacheEnabled(boolean);
@@ -27595,7 +27620,6 @@ package android.widget {
2759527620
method protected void resetResolvedDrawables();
2759627621
method protected void resetResolvedLayoutDirection();
2759727622
method protected void resolveDrawables();
27598-
method protected void resolveTextDirection();
2759927623
method public void setAllCaps(boolean);
2760027624
method public final void setAutoLinkMask(int);
2760127625
method public void setCompoundDrawablePadding(int);

core/java/android/text/TextDirectionHeuristics.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@
1717
package android.text;
1818

1919

20-
import java.util.Locale;
21-
2220
import android.util.LocaleUtil;
2321

2422
/**
2523
* Some objects that implement TextDirectionHeuristic.
26-
* @hide
2724
*/
2825
public class TextDirectionHeuristics {
2926

@@ -74,9 +71,8 @@ private static enum TriState {
7471
* Computes the text direction based on an algorithm. Subclasses implement
7572
* {@link #defaultIsRtl} to handle cases where the algorithm cannot determine the
7673
* direction from the text alone.
77-
* @hide
7874
*/
79-
public static abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {
75+
private static abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {
8076
private final TextDirectionAlgorithm mAlgorithm;
8177

8278
public TextDirectionHeuristicImpl(TextDirectionAlgorithm algorithm) {
@@ -157,13 +153,11 @@ private static TriState isRtlTextOrFormat(int directionality) {
157153
/**
158154
* Interface for an algorithm to guess the direction of a paragraph of text.
159155
*
160-
* @hide
161156
*/
162-
public static interface TextDirectionAlgorithm {
157+
private static interface TextDirectionAlgorithm {
163158
/**
164159
* Returns whether the range of text is RTL according to the algorithm.
165160
*
166-
* @hide
167161
*/
168162
TriState checkRtl(char[] text, int start, int count);
169163
}
@@ -173,9 +167,8 @@ public static interface TextDirectionAlgorithm {
173167
* the paragraph direction. This is the standard Unicode Bidirectional
174168
* algorithm.
175169
*
176-
* @hide
177170
*/
178-
public static class FirstStrong implements TextDirectionAlgorithm {
171+
private static class FirstStrong implements TextDirectionAlgorithm {
179172
@Override
180173
public TriState checkRtl(char[] text, int start, int count) {
181174
TriState result = TriState.UNKNOWN;
@@ -196,9 +189,8 @@ private FirstStrong() {
196189
* character (e.g. excludes LRE, LRO, RLE, RLO) to determine the
197190
* direction of text.
198191
*
199-
* @hide
200192
*/
201-
public static class AnyStrong implements TextDirectionAlgorithm {
193+
private static class AnyStrong implements TextDirectionAlgorithm {
202194
private final boolean mLookForRtl;
203195

204196
@Override
@@ -239,7 +231,7 @@ private AnyStrong(boolean lookForRtl) {
239231
/**
240232
* Algorithm that uses the Locale direction to force the direction of a paragraph.
241233
*/
242-
public static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl {
234+
private static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl {
243235

244236
public TextDirectionHeuristicLocale() {
245237
super(null);

core/java/android/view/View.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,7 +2618,6 @@ static class ListenerInfo {
26182618

26192619
/**
26202620
* Text direction is inherited thru {@link ViewGroup}
2621-
* @hide
26222621
*/
26232622
public static final int TEXT_DIRECTION_INHERIT = 0;
26242623

@@ -2627,7 +2626,6 @@ static class ListenerInfo {
26272626
* determines the paragraph direction. If there is no strong directional character, the
26282627
* paragraph direction is the view's resolved layout direction.
26292628
*
2630-
* @hide
26312629
*/
26322630
public static final int TEXT_DIRECTION_FIRST_STRONG = 1;
26332631

@@ -2636,42 +2634,36 @@ static class ListenerInfo {
26362634
* any strong RTL character, otherwise it is LTR if it contains any strong LTR characters.
26372635
* If there are neither, the paragraph direction is the view's resolved layout direction.
26382636
*
2639-
* @hide
26402637
*/
26412638
public static final int TEXT_DIRECTION_ANY_RTL = 2;
26422639

26432640
/**
26442641
* Text direction is forced to LTR.
26452642
*
2646-
* @hide
26472643
*/
26482644
public static final int TEXT_DIRECTION_LTR = 3;
26492645

26502646
/**
26512647
* Text direction is forced to RTL.
26522648
*
2653-
* @hide
26542649
*/
26552650
public static final int TEXT_DIRECTION_RTL = 4;
26562651

26572652
/**
26582653
* Text direction is coming from the system Locale.
26592654
*
2660-
* @hide
26612655
*/
26622656
public static final int TEXT_DIRECTION_LOCALE = 5;
26632657

26642658
/**
26652659
* Default text direction is inherited
26662660
*
2667-
* @hide
26682661
*/
26692662
protected static int DEFAULT_TEXT_DIRECTION = TEXT_DIRECTION_INHERIT;
26702663

26712664
/**
26722665
* The text direction that has been defined by {@link #setTextDirection(int)}.
26732666
*
2674-
* {@hide}
26752667
*/
26762668
@ViewDebug.ExportedProperty(category = "text", mapping = {
26772669
@ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
@@ -2689,7 +2681,6 @@ static class ListenerInfo {
26892681
* not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds up the parent
26902682
* chain of the view.
26912683
*
2692-
* {@hide}
26932684
*/
26942685
@ViewDebug.ExportedProperty(category = "text", mapping = {
26952686
@ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
@@ -14106,7 +14097,6 @@ protected float getHorizontalScrollFactor() {
1410614097
* {@link #TEXT_DIRECTION_RTL},
1410714098
* {@link #TEXT_DIRECTION_LOCALE},
1410814099
*
14109-
* @hide
1411014100
*/
1411114101
public int getTextDirection() {
1411214102
return mTextDirection;
@@ -14124,7 +14114,6 @@ public int getTextDirection() {
1412414114
* {@link #TEXT_DIRECTION_RTL},
1412514115
* {@link #TEXT_DIRECTION_LOCALE},
1412614116
*
14127-
* @hide
1412814117
*/
1412914118
public void setTextDirection(int textDirection) {
1413014119
if (textDirection != mTextDirection) {
@@ -14145,7 +14134,6 @@ public void setTextDirection(int textDirection) {
1414514134
* {@link #TEXT_DIRECTION_RTL},
1414614135
* {@link #TEXT_DIRECTION_LOCALE},
1414714136
*
14148-
* @hide
1414914137
*/
1415014138
public int getResolvedTextDirection() {
1415114139
if (mResolvedTextDirection == TEXT_DIRECTION_INHERIT) {
@@ -14157,7 +14145,6 @@ public int getResolvedTextDirection() {
1415714145
/**
1415814146
* Resolve the text direction.
1415914147
*
14160-
* @hide
1416114148
*/
1416214149
protected void resolveTextDirection() {
1416314150
if (mTextDirection != TEXT_DIRECTION_INHERIT) {
@@ -14174,7 +14161,6 @@ protected void resolveTextDirection() {
1417414161
/**
1417514162
* Reset resolved text direction. Will be resolved during a call to getResolvedTextDirection().
1417614163
*
14177-
* @hide
1417814164
*/
1417914165
protected void resetResolvedTextDirection() {
1418014166
mResolvedTextDirection = TEXT_DIRECTION_INHERIT;

core/res/res/values/public.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,4 +3495,6 @@
34953495
=============================================================== -->
34963496
<public type="attr" name="isolatedProcess" id="0x010103a7" />
34973497

3498+
<public type="attr" name="textDirection"/>
3499+
34983500
</resources>

0 commit comments

Comments
 (0)