Merge "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." into nyc-dev am: abef602 am: 82f3228

am: 94e6245

* commit '94e6245a809cd5b8e8bef25f36fb1ebd841ab447':
  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.

Change-Id: I78cbd3a39973e38d81640b994858690e6e90c8ae
This commit is contained in:
shwetachahar
2016-04-18 15:15:01 +00:00
committed by android-build-merger

View File

@@ -252,15 +252,12 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
private void initSettings() { private void initSettings() {
final ContentResolver resolver = getContentResolver(); final ContentResolver resolver = getContentResolver();
// Set up the default rate and pitch. // Set up the default rate and pitch.
try { mDefaultRate = android.provider.Settings.Secure.getInt(
mDefaultPitch = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH); resolver, TTS_DEFAULT_RATE, TextToSpeech.Engine.DEFAULT_RATE);
mDefaultRate = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE); mDefaultPitch = android.provider.Settings.Secure.getInt(
} catch (SettingNotFoundException e) { resolver, TTS_DEFAULT_PITCH, TextToSpeech.Engine.DEFAULT_PITCH);
// Default rate and pitch setting not found, initialize it.
mDefaultPitch = TextToSpeech.Engine.DEFAULT_PITCH;
mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
}
mDefaultRatePref.setProgress(mDefaultRate); mDefaultRatePref.setProgress(mDefaultRate);
mDefaultRatePref.setOnPreferenceChangeListener(this); mDefaultRatePref.setOnPreferenceChangeListener(this);
mDefaultRatePref.setMax(MAX_SPEECH_RATE); mDefaultRatePref.setMax(MAX_SPEECH_RATE);
@@ -269,7 +266,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
mDefaultPitchPref.setOnPreferenceChangeListener(this); mDefaultPitchPref.setOnPreferenceChangeListener(this);
mDefaultPitchPref.setMax(getPitchSeekBarProgressFromSpeechPitchValue(MAX_SPEECH_PITCH)); 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; SettingsActivity activity = null;
if (getActivity() instanceof SettingsActivity) { if (getActivity() instanceof SettingsActivity) {