use of android.speech.tts.TextToSpeech.EngineInfo in project android_packages_apps_Settings by LineageOS.
the class TextToSpeechSettings method initSettings.
private void initSettings() {
final ContentResolver resolver = getContentResolver();
// 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(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, mDefaultRate));
mDefaultRatePref.setOnPreferenceChangeListener(this);
mDefaultRatePref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, MAX_SPEECH_RATE));
mDefaultPitchPref.setProgress(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, mDefaultPitch));
mDefaultPitchPref.setOnPreferenceChangeListener(this);
mDefaultPitchPref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, 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) {
activity = (SettingsActivity) getActivity();
} else {
throw new IllegalStateException("TextToSpeechSettings used outside a " + "Settings");
}
if (mCurrentEngine != null) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
((GearPreference) mEnginePreference).setOnGearClickListener(this);
mEnginePreference.setSummary(info.label);
}
checkVoiceData(mCurrentEngine);
}
use of android.speech.tts.TextToSpeech.EngineInfo in project android_packages_apps_Settings by omnirom.
the class TextToSpeechSettings method initSettings.
private void initSettings() {
final ContentResolver resolver = getContentResolver();
// 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(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, mDefaultRate));
mDefaultRatePref.setOnPreferenceChangeListener(this);
mDefaultRatePref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, MAX_SPEECH_RATE));
mDefaultPitchPref.setProgress(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, mDefaultPitch));
mDefaultPitchPref.setOnPreferenceChangeListener(this);
mDefaultPitchPref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, 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) {
activity = (SettingsActivity) getActivity();
} else {
throw new IllegalStateException("TextToSpeechSettings used outside a " + "Settings");
}
if (mCurrentEngine != null) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
((GearPreference) mEnginePreference).setOnGearClickListener(this);
mEnginePreference.setSummary(info.label);
}
checkVoiceData(mCurrentEngine);
}
use of android.speech.tts.TextToSpeech.EngineInfo in project android_packages_apps_Settings by omnirom.
the class TextToSpeechSettings method onGearClick.
@Override
public void onGearClick(GearPreference p) {
if (KEY_TTS_ENGINE_PREFERENCE.equals(p.getKey())) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
final Intent settingsIntent = mEnginesHelper.getSettingsIntent(info.name);
startActivity(settingsIntent);
}
}
use of android.speech.tts.TextToSpeech.EngineInfo in project android_packages_apps_Settings by crdroidandroid.
the class TextToSpeechSettings method onGearClick.
@Override
public void onGearClick(GearPreference p) {
if (KEY_TTS_ENGINE_PREFERENCE.equals(p.getKey())) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
final Intent settingsIntent = mEnginesHelper.getSettingsIntent(info.name);
startActivity(settingsIntent);
}
}
use of android.speech.tts.TextToSpeech.EngineInfo in project android_packages_apps_Settings by SudaMod.
the class TextToSpeechSettings method initSettings.
private void initSettings() {
final ContentResolver resolver = getContentResolver();
// 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(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, mDefaultRate));
mDefaultRatePref.setOnPreferenceChangeListener(this);
mDefaultRatePref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, MAX_SPEECH_RATE));
mDefaultPitchPref.setProgress(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, mDefaultPitch));
mDefaultPitchPref.setOnPreferenceChangeListener(this);
mDefaultPitchPref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, 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) {
activity = (SettingsActivity) getActivity();
} else {
throw new IllegalStateException("TextToSpeechSettings used outside a " + "Settings");
}
if (mCurrentEngine != null) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
((GearPreference) mEnginePreference).setOnGearClickListener(this);
mEnginePreference.setSummary(info.label);
}
checkVoiceData(mCurrentEngine);
}
Aggregations