diff options
author | Craig Mautner <cmautner@google.com> | 2014-06-30 14:48:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-26 23:50:27 +0000 |
commit | 746078fb71c6bb066a048395303114ed5879c64e (patch) | |
tree | e7e1d302151584949920656f9a921e19cb36f43e | |
parent | 8d020f6c089720f86bdb53268dbb6fa3da0e5a4f (diff) | |
parent | 5a98d4368188816739243243c0a6d257b61acac1 (diff) | |
download | packages_apps_Settings-746078fb71c6bb066a048395303114ed5879c64e.zip packages_apps_Settings-746078fb71c6bb066a048395303114ed5879c64e.tar.gz packages_apps_Settings-746078fb71c6bb066a048395303114ed5879c64e.tar.bz2 |
Merge "Take TextToSpeechSettings out of endless loop"
-rw-r--r-- | src/com/android/settings/tts/TextToSpeechSettings.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java index 8417cfd..b16ab56 100644 --- a/src/com/android/settings/tts/TextToSpeechSettings.java +++ b/src/com/android/settings/tts/TextToSpeechSettings.java @@ -47,6 +47,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.MissingResourceException; +import java.util.Objects; import java.util.Set; public class TextToSpeechSettings extends SettingsPreferenceFragment implements @@ -104,7 +105,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements private TextToSpeech mTts = null; private TtsEngines mEnginesHelper = null; - private String mSampleText = ""; + private String mSampleText = null; /** * Default locale used by selected TTS engine, null if not connected to any engine. @@ -270,10 +271,14 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements // ISO-3166 alpha 3 country codes are out of spec. If we won't normalize, // we may end up with English (USA)and German (DEU). + final Locale oldDefaultLocale = mCurrentDefaultLocale; mCurrentDefaultLocale = mEnginesHelper.parseLocaleString(defaultLocale.toString()); + if (!Objects.equals(oldDefaultLocale, mCurrentDefaultLocale)) { + mSampleText = null; + } int defaultAvailable = mTts.setLanguage(defaultLocale); - if (evaluateDefaultLocale()) { + if (evaluateDefaultLocale() && mSampleText == null) { getSampleText(); } } |