Search in sources :

Example 86 with Preference

use of android.support.v7.preference.Preference in project android_packages_apps_crDroidSettings by crdroidandroid.

the class VolumeSteps method updateVolumeStepPrefs.

private void updateVolumeStepPrefs(Preference pref, int steps) {
    if (pref == null || !(pref instanceof ListPreference)) {
        return;
    }
    final ListPreference listPref = (ListPreference) pref;
    listPref.setSummary(String.valueOf(steps));
    listPref.setValue(String.valueOf(steps));
}
Also used : ListPreference(android.support.v7.preference.ListPreference)

Example 87 with Preference

use of android.support.v7.preference.Preference in project materialistic by hidroh.

the class Preferences method sync.

private static void sync(PreferenceManager preferenceManager, String key) {
    Preference pref = preferenceManager.findPreference(key);
    if (pref instanceof ListPreference) {
        ListPreference listPref = (ListPreference) pref;
        pref.setSummary(listPref.getEntry());
    }
}
Also used : ListPreference(android.support.v7.preference.ListPreference) Preference(android.support.v7.preference.Preference) ThemePreference(io.github.hidroh.materialistic.preference.ThemePreference) ListPreference(android.support.v7.preference.ListPreference)

Example 88 with Preference

use of android.support.v7.preference.Preference in project fresco by facebook.

the class SettingsFragment method onSharedPreferenceChanged.

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Preference preference = findPreference(key);
    switch(key) {
        case Const.DATA_SOURCE_KEY:
            updateDataSourceSummary(preference);
            break;
        case Const.RECYCLER_LAYOUT_KEY:
            updateRecyclerLayoutSummary(preference);
            break;
        case Const.GRID_SPAN_COUNT_KEY:
            updateGridRecyclerLayoutSummary();
            break;
        case Const.INFINITE_DATA_SOURCE_KEY:
            updateInfiniteDataSourceSummary(preference);
            break;
        case Const.DISTINCT_DATA_SOURCE_KEY:
            updateDistinctDataSourceSummary(preference);
            break;
        case Const.REUSE_OLD_CONTROLLER_KEY:
            updateReuseOldControllerSummary(preference);
            break;
        case Const.ROUNDED_CORNERS_KEY:
            updateRoundedCornersSummary(preference);
            break;
        case Const.ROUNDED_AS_CIRCLE_KEY:
            updateRoundedAsCircleSummary(preference);
            break;
        case Const.USE_POSTPROCESSOR_KEY:
            updateUsePostprocessorSummary(preference);
            break;
        case Const.POSTPROCESSOR_TYPE_KEY:
            updateWhatPostprocessorSummary(preference);
            break;
        case Const.SCALE_TYPE_KEY:
            updateWhatScaleTypeSummary(preference);
            break;
        case Const.AUTO_ROTATE_KEY:
            updateAutoRotateSummary(preference);
            break;
        case Const.FORCED_ROTATION_ANGLE_KEY:
            updateRotationAngleSummary(preference);
            break;
        case Const.DOWNSAMPLING_KEY:
            updateDownsamplingSummary(preference);
            getShowRestartMessageDialog().show(getChildFragmentManager(), null);
            break;
        case Const.WEBP_SUPPORT_KEY:
            updateWebpSupportSummary(preference);
            getShowRestartMessageDialog().show(getChildFragmentManager(), null);
            break;
        case Const.DECODING_THREAD_KEY:
            updateNumberOfDecodingThreadSummary(preference);
            getShowRestartMessageDialog().show(getChildFragmentManager(), null);
            break;
        case Const.INSTRUMENTATION_ENABLED_KEY:
            updateInstrumentationSummary(preference);
            break;
        case Const.DECODE_CANCELLATION_KEY:
            updateDecodeCancellationSummary(preference);
            getShowRestartMessageDialog().show(getChildFragmentManager(), null);
            break;
        case Const.DRAWEE_OVERLAY_KEY:
            updateDraweeOverlaySummary(preference);
            getShowRestartMessageDialog().show(getChildFragmentManager(), null);
            break;
        case Const.BG_COLOR_KEY:
            updateBgColorSummary(preference);
            break;
        case Const.OVERRIDE_SIZE_KEY:
            updateOverrideSizeSummary(preference);
            break;
        case Const.FADE_DURATION_KEY:
            updateFadeDurationSummary(preference);
            break;
        case Const.DRAW_BORDER_KEY:
            updateDrawBorderSummary(preference);
            break;
    }
}
Also used : CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) ListPreference(android.support.v7.preference.ListPreference) Preference(android.support.v7.preference.Preference)

Example 89 with Preference

use of android.support.v7.preference.Preference in project fresco by facebook.

the class SettingsFragment method updateNumberOfDecodingThreadSummary.

private void updateNumberOfDecodingThreadSummary(final Preference preference) {
    final ListPreference listPreference = (ListPreference) preference;
    final int valueIndex = listPreference.findIndexOfValue(listPreference.getValue());
    String summary = getResources().getStringArray(R.array.decoding_thread_summaries)[valueIndex];
    if (valueIndex == 0) {
        summary += Const.NUMBER_OF_PROCESSORS;
    }
    preference.setSummary(summary);
}
Also used : ListPreference(android.support.v7.preference.ListPreference)

Example 90 with Preference

use of android.support.v7.preference.Preference in project fresco by facebook.

the class SettingsFragment method populateVersionAndDeviceDetails.

private void populateVersionAndDeviceDetails() {
    final Preference preferenceAndroidVersion = findPreference(KEY_DETAILS_ANDROID_VERSION);
    final String androidVersion = getString(R.string.preference_details_android_version_summary, String.valueOf(Build.VERSION.SDK_INT), Build.VERSION.RELEASE);
    preferenceAndroidVersion.setSummary(androidVersion);
    final Preference preferenceCpuArchitecture = findPreference(KEY_DETAILS_CPU_ARCHITECTURE);
    final String cpuArch = System.getProperty("os.arch");
    final String cpuDetails;
    if (Build.VERSION.SDK_INT < 21) {
        cpuDetails = getString(R.string.preference_details_cpu_architecture_summary_before_21, cpuArch, Build.CPU_ABI, Build.CPU_ABI2);
    } else {
        cpuDetails = getString(R.string.preference_details_cpu_architecture_summary_after_21, cpuArch, Arrays.toString(Build.SUPPORTED_ABIS));
    }
    preferenceCpuArchitecture.setSummary(cpuDetails);
    final Preference preferenceDeviceName = findPreference(KEY_DETAILS_DEVICE_NAME);
    final String deviceName = getString(R.string.preference_details_device_name_summary, Build.MANUFACTURER, Build.DEVICE);
    preferenceDeviceName.setSummary(deviceName);
}
Also used : Preference(android.support.v7.preference.Preference)

Aggregations

Preference (android.support.v7.preference.Preference)122 PreferenceScreen (android.support.v7.preference.PreferenceScreen)44 SwitchPreference (android.support.v14.preference.SwitchPreference)33 Intent (android.content.Intent)27 ListPreference (android.support.v7.preference.ListPreference)27 Context (android.content.Context)17 PreferenceCategory (android.support.v7.preference.PreferenceCategory)17 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)15 ArrayList (java.util.ArrayList)14 PackageManager (android.content.pm.PackageManager)11 OnPreferenceClickListener (android.support.v7.preference.Preference.OnPreferenceClickListener)11 PreferenceGroup (android.support.v7.preference.PreferenceGroup)11 TwoStatePreference (android.support.v7.preference.TwoStatePreference)11 Activity (android.app.Activity)10 View (android.view.View)10 Bundle (android.os.Bundle)9 TextView (android.widget.TextView)8 AlertDialog (android.support.v7.app.AlertDialog)7 CheckBoxPreference (android.support.v7.preference.CheckBoxPreference)7 DimmableIconPreference (com.android.settings.DimmableIconPreference)7