diff options
author | Charles Chen <clchen@google.com> | 2010-04-06 15:50:42 -0700 |
---|---|---|
committer | Charles Chen <clchen@google.com> | 2010-04-06 16:03:33 -0700 |
commit | 473111bcfca1342fdbd74af10189931a386c8f24 (patch) | |
tree | 814fc92bda2e79fac4063d472293a8387910930f /src/com/android/settings | |
parent | 6e74d41bd0525459c43ed010e8f049ffc20ca362 (diff) | |
download | packages_apps_settings-473111bcfca1342fdbd74af10189931a386c8f24.zip packages_apps_settings-473111bcfca1342fdbd74af10189931a386c8f24.tar.gz packages_apps_settings-473111bcfca1342fdbd74af10189931a386c8f24.tar.bz2 |
Fixing bug #2575499 - TextToSpeech Settings did not verify that the
current default language was still supported when the default engine
changes.
Change-Id: I2f4b986311161ceaa9d4b9cf3a495f536d9425cd
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/TextToSpeechSettings.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java index 23959c8..fa9ea58 100644 --- a/src/com/android/settings/TextToSpeechSettings.java +++ b/src/com/android/settings/TextToSpeechSettings.java @@ -401,6 +401,28 @@ public class TextToSpeechSettings extends PreferenceActivity implements ttsLanguagePref.setEntries(entries); ttsLanguagePref.setEntryValues(entryValues); mEnableDemo = true; + // Make sure that the default language can be used. + int languageResult = mTts.setLanguage( + new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant)); + if (languageResult < TextToSpeech.LANG_AVAILABLE){ + Locale currentLocale = Locale.getDefault(); + mDefaultLanguage = currentLocale.getISO3Language(); + mDefaultCountry = currentLocale.getISO3Country(); + mDefaultLocVariant = currentLocale.getVariant(); + languageResult = mTts.setLanguage( + new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant)); + // If the default Locale isn't supported, just choose the first available + // language so that there is at least something. + if (languageResult < TextToSpeech.LANG_AVAILABLE){ + parseLocaleInfo(ttsLanguagePref.getEntryValues()[0].toString()); + mTts.setLanguage( + new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant)); + } + ContentResolver resolver = getContentResolver(); + Settings.Secure.putString(resolver, TTS_DEFAULT_LANG, mDefaultLanguage); + Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, mDefaultCountry); + Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, mDefaultLocVariant); + } } else { mEnableDemo = false; } |