Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7beae3f authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Make textDirection API public

Change-Id: I2d5a0e3a990b9a5b78a3bbc8df7f655702743e4b
parent 95d4c993
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -992,6 +992,7 @@ package android {
    field public static final int textColorTertiary = 16843282; // 0x1010212
    field public static final int textColorTertiaryInverse = 16843283; // 0x1010213
    field public static final int textCursorDrawable = 16843618; // 0x1010362
    field public static final int textDirection = 16843688; // 0x10103a8
    field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315
    field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
    field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
@@ -20478,6 +20479,19 @@ package android.text {
    method public int getTopPadding();
  }
  public abstract interface TextDirectionHeuristic {
  }
  public class TextDirectionHeuristics {
    ctor public TextDirectionHeuristics();
    field public static final android.text.TextDirectionHeuristic ANYRTL_LTR;
    field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_LTR;
    field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_RTL;
    field public static final android.text.TextDirectionHeuristic LOCALE;
    field public static final android.text.TextDirectionHeuristic LTR;
    field public static final android.text.TextDirectionHeuristic RTL;
  }
  public class TextPaint extends android.graphics.Paint {
    ctor public TextPaint();
    ctor public TextPaint(int);
@@ -23171,6 +23185,7 @@ package android.view {
    method public final android.view.ViewParent getParent();
    method public float getPivotX();
    method public float getPivotY();
    method public int getResolvedTextDirection();
    method public android.content.res.Resources getResources();
    method public final int getRight();
    method protected float getRightFadingEdgeStrength();
@@ -23190,6 +23205,7 @@ package android.view {
    method public int getSystemUiVisibility();
    method public java.lang.Object getTag();
    method public java.lang.Object getTag(int);
    method public int getTextDirection();
    method public final int getTop();
    method protected float getTopFadingEdgeStrength();
    method protected int getTopPaddingOffset();
@@ -23321,8 +23337,10 @@ package android.view {
    method public void requestLayout();
    method public boolean requestRectangleOnScreen(android.graphics.Rect);
    method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
    method protected void resetResolvedTextDirection();
    method public static int resolveSize(int, int);
    method public static int resolveSizeAndState(int, int, int);
    method protected void resolveTextDirection();
    method public void restoreHierarchyState(android.util.SparseArray<android.os.Parcelable>);
    method public void saveHierarchyState(android.util.SparseArray<android.os.Parcelable>);
    method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
@@ -23402,6 +23420,7 @@ package android.view {
    method public void setSystemUiVisibility(int);
    method public void setTag(java.lang.Object);
    method public void setTag(int, java.lang.Object);
    method public void setTextDirection(int);
    method public final void setTop(int);
    method public void setTouchDelegate(android.view.TouchDelegate);
    method public void setTranslationX(float);
@@ -23424,6 +23443,7 @@ package android.view {
    method public boolean willNotCacheDrawing();
    method public boolean willNotDraw();
    field public static final android.util.Property ALPHA;
    field protected static int DEFAULT_TEXT_DIRECTION;
    field public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0
    field public static final int DRAWING_CACHE_QUALITY_HIGH = 1048576; // 0x100000
    field public static final int DRAWING_CACHE_QUALITY_LOW = 524288; // 0x80000
@@ -23500,6 +23520,12 @@ package android.view {
    field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2
    field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
    field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
    field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2
    field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1
    field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0
    field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5
    field public static final int TEXT_DIRECTION_LTR = 3; // 0x3
    field public static final int TEXT_DIRECTION_RTL = 4; // 0x4
    field public static final android.util.Property TRANSLATION_X;
    field public static final android.util.Property TRANSLATION_Y;
    field protected static final java.lang.String VIEW_LOG_TAG = "View";
@@ -23766,7 +23792,6 @@ package android.view {
    method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public void requestTransparentRegion(android.view.View);
    method protected void resetResolvedLayoutDirection();
    method protected void resetResolvedTextDirection();
    method public void scheduleLayoutAnimation();
    method public void setAddStatesFromChildren(boolean);
    method public void setAlwaysDrawnWithCacheEnabled(boolean);
@@ -27595,7 +27620,6 @@ package android.widget {
    method protected void resetResolvedDrawables();
    method protected void resetResolvedLayoutDirection();
    method protected void resolveDrawables();
    method protected void resolveTextDirection();
    method public void setAllCaps(boolean);
    method public final void setAutoLinkMask(int);
    method public void setCompoundDrawablePadding(int);
+5 −13
Original line number Diff line number Diff line
@@ -17,13 +17,10 @@
package android.text;


import java.util.Locale;

import android.util.LocaleUtil;

/**
 * Some objects that implement TextDirectionHeuristic.
 * @hide
 */
public class TextDirectionHeuristics {

@@ -74,9 +71,8 @@ public class TextDirectionHeuristics {
     * Computes the text direction based on an algorithm.  Subclasses implement
     * {@link #defaultIsRtl} to handle cases where the algorithm cannot determine the
     * direction from the text alone.
     * @hide
     */
    public static abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {
    private static abstract class TextDirectionHeuristicImpl implements TextDirectionHeuristic {
        private final TextDirectionAlgorithm mAlgorithm;

        public TextDirectionHeuristicImpl(TextDirectionAlgorithm algorithm) {
@@ -157,13 +153,11 @@ public class TextDirectionHeuristics {
    /**
     * Interface for an algorithm to guess the direction of a paragraph of text.
     *
     * @hide
     */
    public static interface TextDirectionAlgorithm {
    private static interface TextDirectionAlgorithm {
        /**
         * Returns whether the range of text is RTL according to the algorithm.
         *
         * @hide
         */
        TriState checkRtl(char[] text, int start, int count);
    }
@@ -173,9 +167,8 @@ public class TextDirectionHeuristics {
     * the paragraph direction.  This is the standard Unicode Bidirectional
     * algorithm.
     *
     * @hide
     */
    public static class FirstStrong implements TextDirectionAlgorithm {
    private static class FirstStrong implements TextDirectionAlgorithm {
        @Override
        public TriState checkRtl(char[] text, int start, int count) {
            TriState result = TriState.UNKNOWN;
@@ -196,9 +189,8 @@ public class TextDirectionHeuristics {
     * character (e.g. excludes LRE, LRO, RLE, RLO) to determine the
     * direction of text.
     *
     * @hide
     */
    public static class AnyStrong implements TextDirectionAlgorithm {
    private static class AnyStrong implements TextDirectionAlgorithm {
        private final boolean mLookForRtl;

        @Override
@@ -239,7 +231,7 @@ public class TextDirectionHeuristics {
    /**
     * Algorithm that uses the Locale direction to force the direction of a paragraph.
     */
    public static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl {
    private static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl {

        public TextDirectionHeuristicLocale() {
            super(null);
+0 −14
Original line number Diff line number Diff line
@@ -2617,7 +2617,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    /**
     * Text direction is inherited thru {@link ViewGroup}
     * @hide
     */
    public static final int TEXT_DIRECTION_INHERIT = 0;
@@ -2626,7 +2625,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * determines the paragraph direction. If there is no strong directional character, the
     * paragraph direction is the view's resolved layout direction.
     *
     * @hide
     */
    public static final int TEXT_DIRECTION_FIRST_STRONG = 1;
@@ -2635,42 +2633,36 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * any strong RTL character, otherwise it is LTR if it contains any strong LTR characters.
     * If there are neither, the paragraph direction is the view's resolved layout direction.
     *
     * @hide
     */
    public static final int TEXT_DIRECTION_ANY_RTL = 2;
    /**
     * Text direction is forced to LTR.
     *
     * @hide
     */
    public static final int TEXT_DIRECTION_LTR = 3;
    /**
     * Text direction is forced to RTL.
     *
     * @hide
     */
    public static final int TEXT_DIRECTION_RTL = 4;
    /**
     * Text direction is coming from the system Locale.
     *
     * @hide
     */
    public static final int TEXT_DIRECTION_LOCALE = 5;
    /**
     * Default text direction is inherited
     *
     * @hide
     */
    protected static int DEFAULT_TEXT_DIRECTION = TEXT_DIRECTION_INHERIT;
    /**
     * The text direction that has been defined by {@link #setTextDirection(int)}.
     *
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "text", mapping = {
            @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
@@ -2688,7 +2680,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds up the parent
     * chain of the view.
     *
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "text", mapping = {
            @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
@@ -13762,7 +13753,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * {@link #TEXT_DIRECTION_RTL},
     * {@link #TEXT_DIRECTION_LOCALE},
     *
     * @hide
     */
    public int getTextDirection() {
        return mTextDirection;
@@ -13780,7 +13770,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * {@link #TEXT_DIRECTION_RTL},
     * {@link #TEXT_DIRECTION_LOCALE},
     *
     * @hide
     */
    public void setTextDirection(int textDirection) {
        if (textDirection != mTextDirection) {
@@ -13801,7 +13790,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * {@link #TEXT_DIRECTION_RTL},
     * {@link #TEXT_DIRECTION_LOCALE},
     *
     * @hide
     */
    public int getResolvedTextDirection() {
        if (mResolvedTextDirection == TEXT_DIRECTION_INHERIT) {
@@ -13813,7 +13801,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    /**
     * Resolve the text direction.
     *
     * @hide
     */
    protected void resolveTextDirection() {
        if (mTextDirection != TEXT_DIRECTION_INHERIT) {
@@ -13830,7 +13817,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    /**
     * Reset resolved text direction. Will be resolved during a call to getResolvedTextDirection().
     *
     * @hide
     */
    protected void resetResolvedTextDirection() {
        mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
+2 −0
Original line number Diff line number Diff line
@@ -3494,4 +3494,6 @@
     =============================================================== -->
  <public type="attr" name="isolatedProcess" id="0x010103a7" />

  <public type="attr" name="textDirection"/>

</resources>