Show current locale as summary for Select language setting.

Bug: 2402834
This commit is contained in:
Amith Yamasani
2010-02-17 16:02:39 -08:00
parent 5435511ee9
commit 0f2e6dec7c
2 changed files with 15 additions and 2 deletions

View File

@@ -18,8 +18,8 @@
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceScreen <PreferenceScreen
android:title="@string/phone_language" android:key="phone_language"
android:summary="@string/phone_language_summary"> android:title="@string/phone_language">
<intent android:action="android.intent.action.MAIN" <intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings" android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.LocalePicker"/> android:targetClass="com.android.settings.LocalePicker"/>

View File

@@ -43,10 +43,12 @@ import java.util.List;
public class LanguageSettings extends PreferenceActivity { public class LanguageSettings extends PreferenceActivity {
private static final String KEY_PHONE_LANGUAGE = "phone_language";
private boolean mHaveHardKeyboard; private boolean mHaveHardKeyboard;
private List<InputMethodInfo> mInputMethodProperties; private List<InputMethodInfo> mInputMethodProperties;
private List<CheckBoxPreference> mCheckboxes; private List<CheckBoxPreference> mCheckboxes;
private Preference mLanguagePref;
final TextUtils.SimpleStringSplitter mStringColonSplitter final TextUtils.SimpleStringSplitter mStringColonSplitter
= new TextUtils.SimpleStringSplitter(':'); = new TextUtils.SimpleStringSplitter(':');
@@ -67,6 +69,8 @@ public class LanguageSettings extends PreferenceActivity {
if (getAssets().getLocales().length == 1) { if (getAssets().getLocales().length == 1) {
getPreferenceScreen(). getPreferenceScreen().
removePreference(findPreference("language_category")); removePreference(findPreference("language_category"));
} else {
mLanguagePref = findPreference(KEY_PHONE_LANGUAGE);
} }
Configuration config = getResources().getConfiguration(); Configuration config = getResources().getConfiguration();
@@ -156,6 +160,15 @@ public class LanguageSettings extends PreferenceActivity {
} }
} }
mLastTickedInputMethodId = null; mLastTickedInputMethodId = null;
if (mLanguagePref != null) {
Configuration conf = getResources().getConfiguration();
String locale = conf.locale.getDisplayName(conf.locale);
if (locale != null && locale.length() > 1) {
locale = Character.toUpperCase(locale.charAt(0)) + locale.substring(1);
mLanguagePref.setSummary(locale);
}
}
} }
@Override @Override