Fixing a problem with the TextToSpeech settings not reflecting

the current engine that the user has selected when displaying
the list of engines that are available.

Change-Id: I77d35ff1c691fd3e5c967fcf367647d415d2468e
This commit is contained in:
Charles Chen
2010-03-22 16:06:05 -07:00
parent 38925c0b96
commit be6e8276e3

View File

@@ -122,6 +122,8 @@ public class TextToSpeechSettings extends PreferenceActivity implements
mEnableDemo = false;
initClickers();
initDefaultSettings();
mTts = new TextToSpeech(this, this);
}
@@ -677,6 +679,14 @@ public class TextToSpeechSettings extends PreferenceActivity implements
enginesPref.setEntries(entries.toArray(entriesArray));
enginesPref.setEntryValues(values.toArray(valuesArray));
// Set the selected engine based on the saved preference
String selectedEngine = Settings.Secure.getString(getContentResolver(), TTS_DEFAULT_SYNTH);
int selectedEngineIndex = enginesPref.findIndexOfValue(selectedEngine);
if (selectedEngineIndex == -1){
selectedEngineIndex = enginesPref.findIndexOfValue(SYSTEM_TTS);
}
enginesPref.setValueIndex(selectedEngineIndex);
}
}