Search in sources :

Example 1 with VoiceInputOutputSettings

use of com.android.settings.VoiceInputOutputSettings in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodAndLanguageSettings method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.language_settings);
    final Activity activity = getActivity();
    mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mInputMethodSettingValues = InputMethodSettingValuesWrapper.getInstance(activity);
    try {
        mDefaultInputMethodSelectorVisibility = Integer.valueOf(getString(R.string.input_method_selector_visibility_default_value));
    } catch (NumberFormatException e) {
    }
    if (activity.getAssets().getLocales().length == 1) {
        // No "Select language" pref if there's only one system locale available.
        getPreferenceScreen().removePreference(findPreference(KEY_PHONE_LANGUAGE));
    } else {
        mLanguagePref = findPreference(KEY_PHONE_LANGUAGE);
    }
    if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
        mShowInputMethodSelectorPref = (ListPreference) findPreference(KEY_INPUT_METHOD_SELECTOR);
        mShowInputMethodSelectorPref.setOnPreferenceChangeListener(this);
        // TODO: Update current input method name on summary
        updateInputMethodSelectorSummary(loadInputMethodSelectorVisibility());
    }
    new VoiceInputOutputSettings(this).onCreate();
    // Get references to dynamically constructed categories.
    mHardKeyboardCategory = (PreferenceCategory) findPreference("hard_keyboard");
    mKeyboardSettingsCategory = (PreferenceCategory) findPreference("keyboard_settings_category");
    mGameControllerCategory = (PreferenceCategory) findPreference("game_controller_settings_category");
    final Intent startingIntent = activity.getIntent();
    // Filter out irrelevant features if invoked from IME settings button.
    mShowsOnlyFullImeAndKeyboardList = Settings.ACTION_INPUT_METHOD_SETTINGS.equals(startingIntent.getAction());
    if (mShowsOnlyFullImeAndKeyboardList) {
        getPreferenceScreen().removeAll();
        if (mHardKeyboardCategory != null) {
            getPreferenceScreen().addPreference(mHardKeyboardCategory);
        }
        if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
            getPreferenceScreen().addPreference(mShowInputMethodSelectorPref);
        }
        if (mKeyboardSettingsCategory != null) {
            mKeyboardSettingsCategory.removeAll();
            getPreferenceScreen().addPreference(mKeyboardSettingsCategory);
        }
    }
    // Build hard keyboard and game controller preference categories.
    mIm = (InputManager) activity.getSystemService(Context.INPUT_SERVICE);
    updateInputDevices();
    // Spell Checker
    final Preference spellChecker = findPreference(KEY_SPELL_CHECKERS);
    if (spellChecker != null) {
        // Note: KEY_SPELL_CHECKERS preference is marked as persistent="false" in XML.
        InputMethodAndSubtypeUtil.removeUnnecessaryNonPersistentPreference(spellChecker);
        final Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setClass(activity, SubSettings.class);
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, SpellCheckersSettings.class.getName());
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.spellcheckers_settings_title);
        spellChecker.setIntent(intent);
    }
    mHandler = new Handler();
    mSettingsObserver = new SettingsObserver(mHandler, activity);
    mDpm = (DevicePolicyManager) (getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE));
    // If we've launched from the keyboard layout notification, go ahead and just show the
    // keyboard layout dialog.
    final InputDeviceIdentifier identifier = startingIntent.getParcelableExtra(Settings.EXTRA_INPUT_DEVICE_IDENTIFIER);
    if (mShowsOnlyFullImeAndKeyboardList && identifier != null) {
        showKeyboardLayoutDialog(identifier);
    }
    updateCurrentImeName();
}
Also used : InputDeviceIdentifier(android.hardware.input.InputDeviceIdentifier) VoiceInputOutputSettings(com.android.settings.VoiceInputOutputSettings) ListPreference(android.support.v7.preference.ListPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) SettingsActivity(com.android.settings.SettingsActivity) KeyboardLayoutPickerActivity(com.android.settings.Settings.KeyboardLayoutPickerActivity) Activity(android.app.Activity) Handler(android.os.Handler) Intent(android.content.Intent)

Aggregations

Activity (android.app.Activity)1 Intent (android.content.Intent)1 InputDeviceIdentifier (android.hardware.input.InputDeviceIdentifier)1 Handler (android.os.Handler)1 SwitchPreference (android.support.v14.preference.SwitchPreference)1 ListPreference (android.support.v7.preference.ListPreference)1 Preference (android.support.v7.preference.Preference)1 KeyboardLayoutPickerActivity (com.android.settings.Settings.KeyboardLayoutPickerActivity)1 SettingsActivity (com.android.settings.SettingsActivity)1 VoiceInputOutputSettings (com.android.settings.VoiceInputOutputSettings)1