Search in sources :

Example 36 with EngineInfo

use of android.speech.tts.TextToSpeech.EngineInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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);
        if (settingsIntent != null) {
            startActivity(settingsIntent);
        } else {
            Log.e(TAG, "settingsIntent is null");
        }
    }
}
Also used : EngineInfo(android.speech.tts.TextToSpeech.EngineInfo) Intent(android.content.Intent)

Example 37 with EngineInfo

use of android.speech.tts.TextToSpeech.EngineInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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);
}
Also used : GearPreference(com.android.settings.widget.GearPreference) EngineInfo(android.speech.tts.TextToSpeech.EngineInfo) SeekBarPreference(com.android.settings.widget.SeekBarPreference) GearPreference(com.android.settings.widget.GearPreference) ActionButtonsPreference(com.android.settingslib.widget.ActionButtonsPreference) Preference(androidx.preference.Preference) ListPreference(androidx.preference.ListPreference) SettingsActivity(com.android.settings.SettingsActivity) ContentResolver(android.content.ContentResolver)

Aggregations

EngineInfo (android.speech.tts.TextToSpeech.EngineInfo)37 Intent (android.content.Intent)15 SettingsActivity (com.android.settings.SettingsActivity)13 ArrayList (java.util.ArrayList)8 ContentResolver (android.content.ContentResolver)7 PackageManager (android.content.pm.PackageManager)7 ResolveInfo (android.content.pm.ResolveInfo)7 ServiceInfo (android.content.pm.ServiceInfo)7 GearPreference (com.android.settings.widget.GearPreference)7 SeekBarPreference (com.android.settings.widget.SeekBarPreference)7 ListPreference (android.support.v7.preference.ListPreference)6 Preference (android.support.v7.preference.Preference)6 LayoutPreference (com.android.settings.applications.LayoutPreference)6 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 ProgressDialog (android.app.ProgressDialog)1 ComponentName (android.content.ComponentName)1 DialogInterface (android.content.DialogInterface)1