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

Commit d26416b8 authored by Arthur Zamarin's avatar Arthur Zamarin
Browse files

Base: Mirroring layout on RTL languages [1/2]

When Force RTL layout (in developer options) is sellected on RTL language (Arabic, Hebrew, etc) - mirror back to LTR.
There is another commit (same name but with [2/2]) which just changes the strings to match the new meaning for RTL languages.

Change-Id: Ib051b976db4e15dab9caddcd0d49276b5ada3f13
parent fda78a5c
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1736,19 +1736,19 @@ public class TextUtils {
     * Be careful: this code will need to be updated when vertical scripts will be supported
     */
    public static int getLayoutDirectionFromLocale(Locale locale) {
        boolean mirror = SystemProperties.getBoolean(Settings.Global.DEVELOPMENT_FORCE_RTL, false);
        if (locale != null && !locale.equals(Locale.ROOT)) {
            final String scriptSubtag = ICU.getScript(ICU.addLikelySubtags(locale.toString()));
            if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale);

            if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) ||
                    scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) {
                return View.LAYOUT_DIRECTION_RTL;
                //If forcing into RTL layout mode and language is RTL,return LTR as default,else RTL
                return mirror ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL;
            }
        }
        // If forcing into RTL layout mode, return RTL as default, else LTR
        return SystemProperties.getBoolean(Settings.Global.DEVELOPMENT_FORCE_RTL, false)
                ? View.LAYOUT_DIRECTION_RTL
                : View.LAYOUT_DIRECTION_LTR;
        //If forcing into RTL layout mode and language is LTR,return RTL as default,else LTR
        return mirror ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR;
    }

    /**