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
This commit is contained in:
Jean-Michel Trivi
2011-03-02 15:47:52 -08:00
parent e18897bc22
commit 8863ce9f4d

View File

@@ -265,6 +265,9 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
}
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 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
mDefaultLocVariant = new String();
}
mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
mTts.setSpeechRate(mDefaultRate/100.0f);
initDefaultSettings();
updateWidgetState();
checkVoiceData();