summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/tts
diff options
context:
space:
mode:
authorshwetachahar <shwetachahar@google.com>2016-04-15 14:25:07 +0100
committershwetachahar <shwetachahar@google.com>2016-04-15 16:48:17 +0100
commit87f3e11da1a3837f72d3b97941d86088d66bd02f (patch)
tree33d38206eb2e79a05e2423fe1030c03712a9f510 /src/com/android/settings/tts
parent2cae2f1613136e42e2b79121055da8b526a92a24 (diff)
downloadpackages_apps_Settings-87f3e11da1a3837f72d3b97941d86088d66bd02f.tar.gz
packages_apps_Settings-87f3e11da1a3837f72d3b97941d86088d66bd02f.tar.bz2
packages_apps_Settings-87f3e11da1a3837f72d3b97941d86088d66bd02f.zip
Replace the try catch block for retrieving pitch and speech rate
values from secure settings with getInt() supplied with a default arg. Also, set the pitch and speech rate of the TTS engine to the default rate and pitch when initSetting() is called. Bug: 27916665 Bug: 27871182 Change-Id: Ie772ee6f29d40774f70e73fe091f6f884472e2f8
Diffstat (limited to 'src/com/android/settings/tts')
-rw-r--r--src/com/android/settings/tts/TextToSpeechSettings.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 0a488748a9..e4bea186cc 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -252,15 +252,12 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
private void initSettings() {
final ContentResolver resolver = getContentResolver();
- // Set up the default rate and pitch.
- try {
- mDefaultPitch = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH);
- mDefaultRate = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE);
- } catch (SettingNotFoundException e) {
- // Default rate and pitch setting not found, initialize it.
- mDefaultPitch = TextToSpeech.Engine.DEFAULT_PITCH;
- mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
- }
+ // Set up the default rate and pitch.
+ mDefaultRate = android.provider.Settings.Secure.getInt(
+ resolver, TTS_DEFAULT_RATE, TextToSpeech.Engine.DEFAULT_RATE);
+ mDefaultPitch = android.provider.Settings.Secure.getInt(
+ resolver, TTS_DEFAULT_PITCH, TextToSpeech.Engine.DEFAULT_PITCH);
+
mDefaultRatePref.setProgress(mDefaultRate);
mDefaultRatePref.setOnPreferenceChangeListener(this);
mDefaultRatePref.setMax(MAX_SPEECH_RATE);
@@ -269,7 +266,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
mDefaultPitchPref.setOnPreferenceChangeListener(this);
mDefaultPitchPref.setMax(getPitchSeekBarProgressFromSpeechPitchValue(MAX_SPEECH_PITCH));
- mCurrentEngine = mTts.getCurrentEngine();
+ if (mTts != null) {
+ mCurrentEngine = mTts.getCurrentEngine();
+ mTts.setSpeechRate(mDefaultRate/100.0f);
+ mTts.setPitch(mDefaultPitch/100.0f);
+ }
SettingsActivity activity = null;
if (getActivity() instanceof SettingsActivity) {