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

Commit 24215eca authored by Mihai Nita's avatar Mihai Nita
Browse files

Fix: RTL sublocales need to display RTL

When the langage selected in the first step is right-to-left the
localized region names should also be rendered right-to-left,
regardless of the UI language of the system itself.
We only need this to happen for the sub-locale because all labels
are localized in the same language (the parent one), so it is all
consistent, not the mixture we have in the language selection.

Bug: 26278041
Change-Id: I54c4306763458be691a1ba0c2bc2dba613beb8c5
parent f3e5d1d4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.app;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -165,6 +166,14 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable {
                    localized.setVisibility(View.VISIBLE);
                    text.setTextLocale(Locale.getDefault());
                }
                if (mCountryMode) {
                    int layoutDir = TextUtils.getLayoutDirectionFromLocale(item.getParent());
                    //noinspection ResourceType
                    convertView.setLayoutDirection(layoutDir);
                    text.setTextDirection(layoutDir == View.LAYOUT_DIRECTION_RTL
                            ? View.TEXT_DIRECTION_RTL
                            : View.TEXT_DIRECTION_LTR);
                }
        }
        return convertView;
    }