Fix bug 3421125 Use default TTS rate for demo in Settings
When initializing the TTS engine, the default speech rate is
correctly read, but the TTS demonstration in the Settings
screen was overriding that value by setting the rate to
its fixed default value after the engine was initialized.
The fix consists in applying the default value after it has
been read from the settings (as is done for the language
for instance).
Change-Id: Ie13dfa3a2a7e59e5e120e74dc41e60afbedea821
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java
index dc3a96b..62edac9 100644
--- a/src/com/android/settings/TextToSpeechSettings.java
+++ b/src/com/android/settings/TextToSpeechSettings.java
@@ -265,6 +265,9 @@
}
mDefaultRatePref.setValue(String.valueOf(mDefaultRate));
mDefaultRatePref.setOnPreferenceChangeListener(this);
+ // apply the default rate so the TTS demo in the Settings screen uses it, even if
+ // the use of default settings is not enforced
+ mTts.setSpeechRate(mDefaultRate/100.0f);
// Default language / country / variant : these three values map to a single ListPref
// representing the matching Locale
@@ -355,7 +358,6 @@
mDefaultLocVariant = new String();
}
mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
- mTts.setSpeechRate(mDefaultRate/100.0f);
initDefaultSettings();
updateWidgetState();
checkVoiceData();