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

Commit c2d256b4 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Improve TextDirection resolution"

parents 04963769 a646145c
Loading
Loading
Loading
Loading
+0 −24
Original line number Original line Diff line number Diff line
@@ -49,22 +49,6 @@ public class TextDirectionHeuristics {
    public static final TextDirectionHeuristic FIRSTSTRONG_RTL =
    public static final TextDirectionHeuristic FIRSTSTRONG_RTL =
        new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, true);
        new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, true);


    /**
     * If the text contains any strong left to right non-format character, determines
     * that the direction is left to right, falling back to left to right if it
     * finds none.
     */
    public static final TextDirectionHeuristic ANYLTR_LTR =
        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, false);

    /**
     * If the text contains any strong left to right non-format character, determines
     * that the direction is left to right, falling back to right to left if it
     * finds none.
     */
    public static final TextDirectionHeuristic ANYLTR_RTL =
        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, true);

    /**
    /**
     * If the text contains any strong right to left non-format character, determines
     * If the text contains any strong right to left non-format character, determines
     * that the direction is right to left, falling back to left to right if it
     * that the direction is right to left, falling back to left to right if it
@@ -73,14 +57,6 @@ public class TextDirectionHeuristics {
    public static final TextDirectionHeuristic ANYRTL_LTR =
    public static final TextDirectionHeuristic ANYRTL_LTR =
        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false);
        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false);


    /**
     * If the text contains any strong right to left non-format character, determines
     * that the direction is right to left, falling back to right to left if it
     * finds none.
     */
    public static final TextDirectionHeuristic ANYRTL_RTL =
        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, true);

    /**
    /**
     * Examines only the strong directional non-format characters, and if either
     * Examines only the strong directional non-format characters, and if either
     * left to right or right to left characters are 60% or more of this total,
     * left to right or right to left characters are 60% or more of this total,
+2 −1
Original line number Original line Diff line number Diff line
@@ -9185,7 +9185,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
            mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
            mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
        }
        }
        jumpDrawablesToCurrentState();
        jumpDrawablesToCurrentState();
        // Order is important here: LayoutDirection should be resolved before Padding and TextDirection
        // Order is important here: LayoutDirection MUST be resolved before Padding
        // and TextDirection
        resolveLayoutDirectionIfNeeded();
        resolveLayoutDirectionIfNeeded();
        resolvePadding();
        resolvePadding();
        resolveTextDirection();
        resolveTextDirection();
+1 −2
Original line number Original line Diff line number Diff line
@@ -10745,8 +10745,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                        TextDirectionHeuristics.FIRSTSTRONG_LTR);
                        TextDirectionHeuristics.FIRSTSTRONG_LTR);
                break;
                break;
            case TEXT_DIRECTION_ANY_RTL:
            case TEXT_DIRECTION_ANY_RTL:
                mTextDir = (defaultIsRtl ? TextDirectionHeuristics.ANYRTL_RTL:
                mTextDir = TextDirectionHeuristics.ANYRTL_LTR;
                        TextDirectionHeuristics.ANYRTL_LTR);
                break;
                break;
            case TEXT_DIRECTION_CHAR_COUNT:
            case TEXT_DIRECTION_CHAR_COUNT:
                mTextDir = (defaultIsRtl ? TextDirectionHeuristics.CHARCOUNT_RTL:
                mTextDir = (defaultIsRtl ? TextDirectionHeuristics.CHARCOUNT_RTL: