Java Code Examples for android.support.v7.preference.Preference#getSummary()
The following examples show how to use
android.support.v7.preference.Preference#getSummary() .
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: MoreInfoFragment.java From memetastic with GNU General Public License v3.0 | 4 votes |
@Override public synchronized void doUpdatePreferences() { super.doUpdatePreferences(); Context context = getContext(); if (context == null) { return; } Locale locale = Locale.getDefault(); String tmp; Preference pref; updateSummary(R.string.pref_key__more_info__project_license, getString(R.string.app_license_name)); // Basic app info if ((pref = findPreference(R.string.pref_key__more_info__app)) != null && pref.getSummary() == null) { pref.setIcon(R.drawable.ic_launcher); pref.setSummary(String.format(locale, "%s\nVersion v%s (%d)", _cu.getPackageIdReal(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0))); } // Extract some build information and publish in summary if ((pref = findPreference(R.string.pref_key__more_info__copy_build_information)) != null && pref.getSummary() == null) { String summary = String.format(locale, "\n<b>Package:</b> %s\n<b>Version:</b> v%s (%d)", _cu.getPackageIdReal(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0)); summary += (tmp = _cu.bcstr("FLAVOR", "")).isEmpty() ? "" : ("\n<b>Flavor:</b> " + tmp.replace("flavor", "")); summary += (tmp = _cu.bcstr("BUILD_TYPE", "")).isEmpty() ? "" : (" (" + tmp + ")"); summary += (tmp = _cu.bcstr("BUILD_DATE", "")).isEmpty() ? "" : ("\n<b>Build date:</b> " + tmp); summary += (tmp = _cu.getAppInstallationSource()).isEmpty() ? "" : ("\n<b>ISource:</b> " + tmp); summary += (tmp = _cu.bcstr("GITHASH", "")).isEmpty() ? "" : ("\n<b>VCS Hash:</b> " + tmp); pref.setSummary(_cu.htmlToSpanned(summary.trim().replace("\n", "<br/>"))); } // Extract project team from raw ressource, where 1 person = 4 lines // 1) Name/Title, 2) Description/Summary, 3) Link/View-Intent, 4) Empty line if ((pref = findPreference(R.string.pref_key__more_info__project_team)) != null && ((PreferenceGroup) pref).getPreferenceCount() == 0) { String[] data = (_cu.readTextfileFromRawRes(R.raw.project_team, "", "").trim() + "\n\n").split("\n"); for (int i = 0; i + 2 < data.length; i += 4) { Preference person = new Preference(context); person.setTitle(data[i]); person.setSummary(data[i + 1]); person.setIcon(R.drawable.ic_person_black_24dp); try { Uri uri = Uri.parse(data[i + 2]); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); person.setIntent(intent); } catch (Exception ignored) { } appendPreference(person, (PreferenceGroup) pref); } } if ((pref = findPreference(R.string.pref_key__more_info__help)) != null) { pref.setTitle(getString(R.string.help) + " / FAQ"); } }
Example 2
Source File: SettingsAboutFragment.java From openlauncher with Apache License 2.0 | 4 votes |
@Override public synchronized void doUpdatePreferences() { super.doUpdatePreferences(); Context context = getContext(); if (context == null) { return; } Locale locale = Locale.getDefault(); String tmp; Preference pref; updateSummary(R.string.pref_key__more_info__project_license, getString(R.string.app_license_name)); // Basic app info if ((pref = findPreference(R.string.pref_key__more_info__app)) != null && pref.getSummary() == null) { pref.setIcon(R.mipmap.ic_launcher); pref.setSummary(String.format(locale, "%s\nVersion v%s (%d)", _cu.getPackageIdReal(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0))); } // Extract some build information and publish in summary if ((pref = findPreference(R.string.pref_key__more_info__copy_build_information)) != null && pref.getSummary() == null) { String summary = String.format(locale, "\n<b>Package:</b> %s\n<b>Version:</b> v%s (%d)", _cu.getPackageIdReal(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0)); summary += (tmp = _cu.bcstr("FLAVOR", "")).isEmpty() ? "" : ("\n<b>Flavor:</b> " + tmp.replace("flavor", "")); summary += (tmp = _cu.bcstr("BUILD_TYPE", "")).isEmpty() ? "" : (" (" + tmp + ")"); summary += (tmp = _cu.bcstr("BUILD_DATE", "")).isEmpty() ? "" : ("\n<b>Build date:</b> " + tmp); summary += (tmp = _cu.getAppInstallationSource()).isEmpty() ? "" : ("\n<b>ISource:</b> " + tmp); summary += (tmp = _cu.bcstr("GITHASH", "")).isEmpty() ? "" : ("\n<b>VCS Hash:</b> " + tmp); pref.setSummary(_cu.htmlToSpanned(summary.trim().replace("\n", "<br/>"))); } // Extract project team from raw resource, where 1 person = 4 lines // 1) Name/Title, 2) Description/Summary, 3) Link/View-Intent, 4) Empty line if ((pref = findPreference(R.string.pref_key__more_info__project_team)) != null && ((PreferenceGroup) pref).getPreferenceCount() == 0) { String[] data = (_cu.readTextfileFromRawRes(R.raw.project, "", "").trim() + "\n\n").split("\n"); for (int i = 0; i + 2 < data.length; i += 4) { Preference person = new Preference(context); person.setTitle(data[i]); person.setSummary(data[i + 1]); person.setIcon(R.drawable.ic_person); try { Uri uri = Uri.parse(data[i + 2]); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); person.setIntent(intent); } catch (Exception ignored) { } appendPreference(person, (PreferenceGroup) pref); } } }
Example 3
Source File: MoreInfoFragment.java From Stringlate with MIT License | 4 votes |
@Override public synchronized void doUpdatePreferences() { super.doUpdatePreferences(); Context context = getContext(); if (context == null) { return; } Locale locale = Locale.getDefault(); String tmp; Preference pref; updateSummary(R.string.pref_key__more_info__project_license, getString(R.string.app_license_name)); // Basic app info if ((pref = findPreference(R.string.pref_key__more_info__app)) != null && pref.getSummary() == null) { pref.setIcon(R.drawable.ic_launcher); pref.setSummary(String.format(locale, "%s\nVersion v%s (%d)", _cu.getPackageName(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0))); } // Extract some build information and publish in summary if ((pref = findPreference(R.string.pref_key__more_info__copy_build_information)) != null && pref.getSummary() == null) { String summary = String.format(locale, "\n<b>Package:</b> %s\n<b>Version:</b> v%s (%d)", _cu.getPackageName(), _cu.getAppVersionName(), _cu.bcint("VERSION_CODE", 0)); summary += (tmp = _cu.bcstr("FLAVOR", "")).isEmpty() ? "" : ("\n<b>Flavor:</b> " + tmp.replace("flavor", "")); summary += (tmp = _cu.bcstr("BUILD_TYPE", "")).isEmpty() ? "" : (" (" + tmp + ")"); summary += (tmp = _cu.bcstr("BUILD_DATE", "")).isEmpty() ? "" : ("\n<b>Build date:</b> " + tmp); summary += (tmp = _cu.getAppInstallationSource()).isEmpty() ? "" : ("\n<b>ISource:</b> " + tmp); summary += (tmp = _cu.bcstr("GITHASH", "")).isEmpty() ? "" : ("\n<b>VCS Hash:</b> " + tmp); pref.setSummary(_cu.htmlToSpanned(summary.trim().replace("\n", "<br/>"))); } // Extract project team from raw ressource, where 1 person = 4 lines // 1) Name/Title, 2) Description/Summary, 3) Link/View-Intent, 4) Empty line if ((pref = findPreference(R.string.pref_key__more_info__project_team)) != null && ((PreferenceGroup) pref).getPreferenceCount() == 0) { String[] data = (_cu.readTextfileFromRawRes(R.raw.project_team, "", "").trim() + "\n\n").split("\n"); for (int i = 0; i + 2 < data.length; i += 4) { Preference person = new Preference(context); person.setTitle(data[i]); person.setSummary(data[i + 1]); person.setIcon(R.drawable.ic_person_black_24dp); try { Uri uri = Uri.parse(data[i + 2]); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); person.setIntent(intent); } catch (Exception ignored) { } appendPreference(person, (PreferenceGroup) pref); } } }