Search in sources :

Example 46 with PreferenceCategory

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);
    }
}
Also used : PreferenceCategory(android.preference.PreferenceCategory)

Example 47 with PreferenceCategory

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();
}
Also used : PreferenceCategory(android.preference.PreferenceCategory) ListPreference(android.preference.ListPreference) Preference(android.preference.Preference) SwitchPreference(android.preference.SwitchPreference) StoragePoint(com.owncloud.android.datastorage.StoragePoint) OnPreferenceChangeListener(android.preference.Preference.OnPreferenceChangeListener) StoragePoint(com.owncloud.android.datastorage.StoragePoint)

Example 48 with PreferenceCategory

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);
        }
    }
}
Also used : Preference(android.preference.Preference) PreferenceCategory(android.preference.PreferenceCategory)

Example 49 with PreferenceCategory

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;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) PreferenceCategory(android.preference.PreferenceCategory) PreferenceGroup(android.preference.PreferenceGroup)

Example 50 with PreferenceCategory

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));
}
Also used : PreferenceCategory(android.preference.PreferenceCategory) CheckBoxPreference(android.preference.CheckBoxPreference)

Aggregations

PreferenceCategory (android.preference.PreferenceCategory)80 Preference (android.preference.Preference)49 PreferenceScreen (android.preference.PreferenceScreen)31 ListPreference (android.preference.ListPreference)30 CheckBoxPreference (android.preference.CheckBoxPreference)26 Intent (android.content.Intent)19 EditTextPreference (android.preference.EditTextPreference)8 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)8 SwitchPreference (android.preference.SwitchPreference)8 ArrayList (java.util.ArrayList)7 Uri (android.net.Uri)6 Bundle (android.os.Bundle)5 SharedPreferences (android.content.SharedPreferences)4 OnPreferenceChangeListener (android.preference.Preference.OnPreferenceChangeListener)4 View (android.view.View)4 OsmandApplication (net.osmand.plus.OsmandApplication)4 Context (android.content.Context)3 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)3 RingtonePreference (android.preference.RingtonePreference)3 ListView (android.widget.ListView)3