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();
}
Aggregations