Java Code Examples for android.preference.Preference#getIntent()
The following examples show how to use
android.preference.Preference#getIntent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CorrectionSettingsFragment.java From openboard with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.prefs_screen_correction); final Context context = getActivity(); final PackageManager pm = context.getPackageManager(); final Preference editPersonalDictionary = findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null : pm.resolveActivity( editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY); if (ri == null) { overwriteUserDictionaryPreference(editPersonalDictionary); } mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT); turnOffUseContactsIfNoPermission(); }
Example 2
Source File: SettingsActivity.java From AndrOBD with GNU General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceClick(Preference preference) { Intent intent = preference.getIntent(); try { if(KEY_BITCOIN.equals(preference.getKey())) { // special handling for bitcoin VIEW intent startActivity(intent); } else { // OPEN intents require result handling intent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(intent, preference.hashCode()); } } catch(Exception e) { log.log(Level.SEVERE, "Settings", e); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show(); } return true; }
Example 3
Source File: CorrectionSettingsFragment.java From Android-Keyboard with Apache License 2.0 | 5 votes |
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.prefs_screen_correction); final Context context = getActivity(); final PackageManager pm = context.getPackageManager(); final Preference dictionaryLink = findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); final Intent intent = dictionaryLink.getIntent(); intent.setClassName(context.getPackageName(), DictionarySettingsActivity.class.getName()); final int number = pm.queryIntentActivities(intent, 0).size(); if (0 >= number) { removePreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); } final Preference editPersonalDictionary = findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null : pm.resolveActivity( editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY); if (ri == null) { overwriteUserDictionaryPreference(editPersonalDictionary); } mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT); turnOffUseContactsIfNoPermission(); }
Example 4
Source File: InputMethodSettingsImpl.java From Android-Keyboard with Apache License 2.0 | 5 votes |
public void updateSubtypeEnabler() { final Preference pref = mSubtypeEnablerPreference; if (pref == null) { return; } final Context context = pref.getContext(); final CharSequence title; if (mSubtypeEnablerTitleRes != 0) { title = context.getString(mSubtypeEnablerTitleRes); } else { title = mSubtypeEnablerTitle; } pref.setTitle(title); final Intent intent = pref.getIntent(); if (intent != null) { intent.putExtra(Intent.EXTRA_TITLE, title); } final String summary = getEnabledSubtypesLabel(context, mImm, mImi); if (!TextUtils.isEmpty(summary)) { pref.setSummary(summary); } if (mSubtypeEnablerIconRes != 0) { pref.setIcon(mSubtypeEnablerIconRes); } else { pref.setIcon(mSubtypeEnablerIcon); } }
Example 5
Source File: CorrectionSettingsFragment.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.prefs_screen_correction); final Context context = getActivity(); final PackageManager pm = context.getPackageManager(); final Preference dictionaryLink = findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); final Intent intent = dictionaryLink.getIntent(); intent.setClassName(context.getPackageName(), DictionarySettingsActivity.class.getName()); final int number = pm.queryIntentActivities(intent, 0).size(); if (0 >= number) { removePreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); } final Preference editPersonalDictionary = findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null : pm.resolveActivity( editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY); if (ri == null) { overwriteUserDictionaryPreference(editPersonalDictionary); } mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT); turnOffUseContactsIfNoPermission(); }
Example 6
Source File: InputMethodSettingsImpl.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
public void updateSubtypeEnabler() { final Preference pref = mSubtypeEnablerPreference; if (pref == null) { return; } final Context context = pref.getContext(); final CharSequence title; if (mSubtypeEnablerTitleRes != 0) { title = context.getString(mSubtypeEnablerTitleRes); } else { title = mSubtypeEnablerTitle; } pref.setTitle(title); final Intent intent = pref.getIntent(); if (intent != null) { intent.putExtra(Intent.EXTRA_TITLE, title); } final String summary = getEnabledSubtypesLabel(context, mImm, mImi); if (!TextUtils.isEmpty(summary)) { pref.setSummary(summary); } if (mSubtypeEnablerIconRes != 0) { pref.setIcon(mSubtypeEnablerIconRes); } else { pref.setIcon(mSubtypeEnablerIcon); } }
Example 7
Source File: CorrectionSettingsFragment.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.prefs_screen_correction); final Context context = getActivity(); final PackageManager pm = context.getPackageManager(); /* * IndicKeyboard: We are not yet supporting dictionary download. final Preference dictionaryLink = findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); final Intent intent = dictionaryLink.getIntent(); intent.setClassName(context.getPackageName(), DictionarySettingsActivity.class.getName()); final int number = pm.queryIntentActivities(intent, 0).size(); if (0 >= number) { */ if (true) { removePreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY); } final Preference editPersonalDictionary = findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); final ResolveInfo ri = USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS ? null : pm.resolveActivity( editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY); if (ri == null) { overwriteUserDictionaryPreference(editPersonalDictionary); } mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT); turnOffUseContactsIfNoPermission(); }
Example 8
Source File: AboutActivity.java From deagle with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen, final Preference preference) { if ("translation".equals(preference.getKey())) { final Locale default_locale = Locale.getDefault(); final Locale locale = Locales.getFrom(getActivity()); if (Locales.switchTo(getActivity(), locale == null || default_locale.equals(locale) ? new Locale("en") : default_locale)) getActivity().recreate(); return true; } else if (preference.getIntent() != null) GooglePlayStore.updatePreferenceIntent(getActivity(), preference); return super.onPreferenceTreeClick(preferenceScreen, preference); }
Example 9
Source File: GooglePlayStore.java From Common with Apache License 2.0 | 4 votes |
public static void updatePreferenceIntent(final Context context, final Preference preference) { final Intent intent = preference.getIntent(); updatePlayUrlIntent(context, intent); }
Example 10
Source File: GooglePlayStore.java From deagle with Apache License 2.0 | 4 votes |
public static void updatePreferenceIntent(final Context context, final Preference preference) { final Intent intent = preference.getIntent(); updatePlayUrlIntent(context, intent); }