From 24215ecadce5f44de33959b4f512482f39ac4c92 Mon Sep 17 00:00:00 2001 From: Mihai Nita Date: Fri, 29 Jan 2016 12:32:56 -0800 Subject: [PATCH] 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 --- core/java/com/android/internal/app/SuggestedLocaleAdapter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/java/com/android/internal/app/SuggestedLocaleAdapter.java b/core/java/com/android/internal/app/SuggestedLocaleAdapter.java index c4ec714302aa..478a56d774a5 100644 --- a/core/java/com/android/internal/app/SuggestedLocaleAdapter.java +++ b/core/java/com/android/internal/app/SuggestedLocaleAdapter.java @@ -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; } -- 2.11.0