use of android.preference.PreferenceCategory in project android by nextcloud.
the class Preferences method setupDetailsCategory.
private void setupDetailsCategory(int accentColor, PreferenceScreen preferenceScreen) {
PreferenceCategory preferenceCategoryDetails = (PreferenceCategory) findPreference("details");
preferenceCategoryDetails.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_details), accentColor));
boolean fPassCodeEnabled = getResources().getBoolean(R.bool.passcode_enabled);
boolean fPrintEnabled = getResources().getBoolean(R.bool.fingerprint_enabled);
boolean fShowHiddenFilesEnabled = getResources().getBoolean(R.bool.show_hidden_files_enabled);
setupPasscodePreference(preferenceCategoryDetails, fPassCodeEnabled);
setupFingerprintPreference(preferenceCategoryDetails, fPrintEnabled);
setupHiddenFilesPreference(preferenceCategoryDetails, fShowHiddenFilesEnabled);
setupExpertModePreference(preferenceCategoryDetails);
if (!fShowHiddenFilesEnabled && !fPrintEnabled && !fPassCodeEnabled) {
preferenceScreen.removePreference(preferenceCategoryDetails);
}
}
use of android.preference.PreferenceCategory in project android by nextcloud.
the class Preferences method setupGeneralCategory.
private void setupGeneralCategory(int accentColor) {
PreferenceCategory preferenceCategoryGeneral = (PreferenceCategory) findPreference("general");
preferenceCategoryGeneral.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_general), accentColor));
mPrefStoragePath = (ListPreference) findPreference(PreferenceKeys.STORAGE_PATH);
if (mPrefStoragePath != null) {
StoragePoint[] storageOptions = DataStorageProvider.getInstance().getAvailableStoragePoints();
String[] entries = new String[storageOptions.length];
String[] values = new String[storageOptions.length];
for (int i = 0; i < storageOptions.length; ++i) {
entries[i] = storageOptions[i].getDescription();
values[i] = storageOptions[i].getPath();
}
mPrefStoragePath.setEntries(entries);
mPrefStoragePath.setEntryValues(values);
mPrefStoragePath.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String newPath = (String) newValue;
if (mStoragePath.equals(newPath)) {
return true;
}
StorageMigration storageMigration = new StorageMigration(Preferences.this, mStoragePath, newPath);
storageMigration.setStorageMigrationProgressListener(Preferences.this);
storageMigration.migrate();
return false;
}
});
}
loadStoragePath();
}
use of android.preference.PreferenceCategory in project Memento-Calendar by alexstyl.
the class MementoPreferenceFragment method fixCategoryTitles.
private void fixCategoryTitles() {
int count = getPreferenceScreen().getPreferenceCount();
for (int i = 0; i < count; i++) {
Preference preference = getPreferenceScreen().getPreference(i);
PreferenceCategory category = Version.as(PreferenceCategory.class, preference);
if (category != null && category.getTitle() != null) {
CharSequence title = category.getTitle().toString();
String accentLessTitle = GreekNameUtils.removeAccents(title);
category.setTitle(accentLessTitle);
}
}
}
use of android.preference.PreferenceCategory in project PhoneProfilesPlus by henrichg.
the class PreferenceFragment method getAllPreferenceScreen.
private ArrayList<Preference> getAllPreferenceScreen(Preference p, ArrayList<Preference> list) {
if (p instanceof PreferenceCategory || p instanceof PreferenceScreen) {
PreferenceGroup pGroup = (PreferenceGroup) p;
int pCount = pGroup.getPreferenceCount();
if (p instanceof PreferenceScreen) {
list.add(p);
}
for (int i = 0; i < pCount; i++) {
getAllPreferenceScreen(pGroup.getPreference(i), list);
}
}
return list;
}
use of android.preference.PreferenceCategory in project Osmand by osmandapp.
the class SettingsMonitoringActivity method createLiveSection.
private void createLiveSection(PreferenceScreen grp) {
PreferenceCategory cat;
cat = new PreferenceCategory(this);
cat.setTitle(R.string.live_monitoring_m);
grp.addPreference(cat);
cat.addPreference(createEditTextPreference(settings.LIVE_MONITORING_URL, R.string.live_monitoring_url, R.string.live_monitoring_url_descr));
final CheckBoxPreference liveMonitoring = createCheckBoxPreference(settings.LIVE_MONITORING, R.string.live_monitoring_m, R.string.live_monitoring_m_descr);
cat.addPreference(liveMonitoring);
cat.addPreference(createTimeListPreference(settings.LIVE_MONITORING_INTERVAL, SECONDS, MINUTES, 1000, R.string.live_monitoring_interval, R.string.live_monitoring_interval_descr));
cat.addPreference(createTimeListPreference(settings.LIVE_MONITORING_MAX_INTERVAL_TO_SEND, null, MAX_INTERVAL_TO_SEND_MINUTES, 1000, R.string.live_monitoring_max_interval_to_send, R.string.live_monitoring_max_interval_to_send_desrc));
}
Aggregations