Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be6e8276 authored by Charles Chen's avatar Charles Chen
Browse files

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
parent 38925c0b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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);
    }

}