Java Code Examples for android.support.v7.preference.Preference#hasKey()
The following examples show how to use
android.support.v7.preference.Preference#hasKey() .
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: SettingsActivity.java From Stringlate with MIT License | 6 votes |
@Override public Boolean onPreferenceClicked(Preference preference) { if (isAdded() && preference.hasKey()) { String key = preference.getKey(); if (key.equals(getString(R.string.pref_key__github_authentication_request))) { Uri url = Uri.parse(GitHub.Authentication.getAuthRequestUrl()); startActivity(new Intent(Intent.ACTION_VIEW, url)); } if (key.equals(getString(R.string.pref_key__language))) { activityRetVal = RESULT.CHANGE_RESTART; } } return false; }
Example 2
Source File: SettingsActivity.java From kimai-android with MIT License | 6 votes |
@Override public Boolean onPreferenceClicked(Preference preference, String key, int keyResId) { if (isAdded() && preference.hasKey()) { AppSettings settings = AppSettings.get(); if (settings.isKeyEqual(key, R.string.profile_1)) { ((SettingsActivity) getActivity()).showFragment(SettingsFragmentProfile.TAG0, true); return true; } else if (settings.isKeyEqual(key, R.string.profile_2)) { ((SettingsActivity) getActivity()).showFragment(SettingsFragmentProfile.TAG1, true); return true; } if (settings.isKeyEqual(key, R.string.profile_3)) { ((SettingsActivity) getActivity()).showFragment(SettingsFragmentProfile.TAG2, true); return true; } } return false; }
Example 3
Source File: GsPreferenceFragmentCompat.java From memetastic with GNU General Public License v3.0 | 5 votes |
@Override @Deprecated public boolean onPreferenceTreeClick(Preference preference) { if (isAdded()) { String key = preference.hasKey() ? preference.getKey() : ""; int keyResId = keyToStringResId(preference); Boolean ret = onPreferenceClicked(preference, key, keyResId); if (ret != null) { return ret; } } return super.onPreferenceTreeClick(preference); }
Example 4
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 5 votes |
@Override @Deprecated public boolean onPreferenceTreeClick(Preference preference) { if (isAdded()) { String key = preference.hasKey() ? preference.getKey() : ""; int keyResId = keyToStringResId(preference); Boolean ret = onPreferenceClicked(preference, key, keyResId); if (ret != null) { return ret; } } return super.onPreferenceTreeClick(preference); }
Example 5
Source File: GsPreferenceFragmentCompat.java From Stringlate with MIT License | 5 votes |
@Override @Deprecated public boolean onPreferenceTreeClick(Preference preference) { if (isAdded() && preference.hasKey()) { Boolean ret = onPreferenceClicked(preference); if (ret != null) { return ret; } } return super.onPreferenceTreeClick(preference); }
Example 6
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 5 votes |
@Override @Deprecated public boolean onPreferenceTreeClick(Preference preference) { if (isAdded()) { String key = preference.hasKey() ? preference.getKey() : ""; int keyResId = keyToStringResId(preference); Boolean ret = onPreferenceClicked(preference, key, keyResId); if (ret != null) { return ret; } } return super.onPreferenceTreeClick(preference); }
Example 7
Source File: SettingsActivity.java From memetastic with GNU General Public License v3.0 | 4 votes |
@SuppressLint("ApplySharedPref") @Override public Boolean onPreferenceClicked(Preference preference, String key, int keyResId) { if (isAdded() && preference.hasKey()) { Context context = getActivity(); AppSettings settings = AppSettings.get(); if (eq(key, R.string.pref_key__memelist_view_type)) { activityRetVal = RESULT.CHANGE_RESTART; } if (eq(key, R.string.pref_key__cleanup_thumbnails)) { new ThumbnailCleanupTask(context).start(); return true; } if (eq(key, R.string.pref_key__is_overview_statusbar_hidden)) { activityRetVal = RESULT.CHANGE_RESTART; } if (eq(key, R.string.pref_key__language)) { activityRetVal = RESULT.CHANGE_RESTART; } if (eq(key, R.string.pref_key__download_assets_try)) { if (PermissionChecker.doIfPermissionGranted(getActivity())) { Date zero = new Date(0); settings.setLastArchiveCheckDate(zero); settings.setLastArchiveDate(zero); settings.getDefaultPreferences().edit().commit(); new AssetUpdater.UpdateThread(context, true).start(); getActivity().finish(); } } if (eq(key, R.string.pref_key__is_show_in_gallery)) { boolean showInGallery = settings.getDefaultPreferences().getBoolean(key, true); File memeDirectory = AssetUpdater.getMemesDir(AppSettings.get()); File noMediaFile = new File(memeDirectory, ".nomedia"); if (showInGallery) { noMediaFile.delete(); MediaStoreUtils.deleteFileFromMediaStore(context, noMediaFile); File[] files = memeDirectory.listFiles(); for (int i = 0; i < files.length; i++) { MediaStoreUtils.deleteFileFromMediaStore(context, files[i]); MediaStoreUtils.addFileToMediaStore(context, files[i]); } } else { try { noMediaFile.createNewFile(); MediaStoreUtils.addFileToMediaStore(context, noMediaFile); } catch (IOException e) { e.printStackTrace(); } } } } return null; }