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

Commit 0b28c757 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix default TextView textDirection heuristic

- use "first strong" instead of "locale"
- optimize "any rtl" heuristic too
- fix a few wording issues too

Change-Id: I239a11a49a7a6a6d45165f593c96e8b6b84f0661
parent 8f502656
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -5030,10 +5030,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                if (mParent != null && mParent instanceof ViewGroup) {
                    resolvedTextDirection = ((ViewGroup) mParent).getResolvedTextDirection();
                } else {
                    // We reached the top of the View hierarchy, so get the direction from
                    // the Locale
                    resolvedTextDirection = isLayoutDirectionRtl(Locale.getDefault()) ?
                            TEXT_DIRECTION_RTL : TEXT_DIRECTION_LTR;
                    // We reached the top of the View hierarchy, so set the text direction
                    // heuristic to "first strong"
                    resolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG;
                }
                break;
            // Pass down the hierarchy the following text direction values
+1 −0
Original line number Diff line number Diff line
@@ -10112,6 +10112,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                foundStrongLtr = true;
            } else if (isStrongRtlChar(dir)) {
                foundStrongRtl = true;
                break;
            }
        }
        if (foundStrongRtl) {
+1 −1
Original line number Diff line number Diff line
@@ -1978,7 +1978,7 @@
            <!-- Default -->
            <enum name="inherit" value="0" />
            <!-- Default for the root view. The first strong directional character determines the
                 paragraph direction.  If there is o strong directional character, the paragraph
                 paragraph direction.  If there is no strong directional character, the paragraph
                 direction is the view’s resolved layout direction. -->
            <enum name="firstStrong" value="1" />
            <!-- The paragraph direction is RTL if it contains any strong RTL character, otherwise