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

* commit 'abef602337c8d362021ebeaf081ff3ca8a2a61f8':
  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: I3f870ed496e86180c3a14b490e6472007230e0e6
This commit is contained in:
shwetachahar
2016-04-18 15:04:53 +00:00
committed by android-build-merger

View File

@@ -253,14 +253,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
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;
}
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));
if (mTts != null) {
mCurrentEngine = mTts.getCurrentEngine();
mTts.setSpeechRate(mDefaultRate/100.0f);
mTts.setPitch(mDefaultPitch/100.0f);
}
SettingsActivity activity = null;
if (getActivity() instanceof SettingsActivity) {