OSDN Git Service

Fix bug 3421125 Use default TTS rate for demo in Settings
authorJean-Michel Trivi <jmtrivi@google.com>
Wed, 2 Mar 2011 23:47:52 +0000 (15:47 -0800)
committerJean-Michel Trivi <jmtrivi@google.com>
Wed, 2 Mar 2011 23:47:52 +0000 (15:47 -0800)
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

src/com/android/settings/TextToSpeechSettings.java

index dc3a96b..62edac9 100644 (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();