Search in sources :

Example 21 with ListPreference

use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TransparencySettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.rr_transparency);
    PreferenceScreen prefSet = getPreferenceScreen();
    final ContentResolver resolver = getActivity().getContentResolver();
    // QS header alpha
    /*mQSHeaderAlpha =
                    (SeekBarPreference) prefSet.findPreference(PREF_QS_TRANSPARENT_HEADER);
            int qSHeaderAlpha = Settings.System.getInt(resolver,
                    Settings.System.QS_TRANSPARENT_HEADER, 255);
            mQSHeaderAlpha.setValue(qSHeaderAlpha / 1);
            mQSHeaderAlpha.setOnPreferenceChangeListener(this);*/
    // QS stroke
    mQSStroke = (ListPreference) findPreference(PREF_QS_STROKE);
    int qSStroke = Settings.System.getIntForUser(resolver, Settings.System.QS_STROKE, 0, UserHandle.USER_CURRENT);
    mQSStroke.setValue(String.valueOf(qSStroke));
    mQSStroke.setSummary(mQSStroke.getEntry());
    mQSStroke.setOnPreferenceChangeListener(this);
    // QS stroke color
    mQSStrokeColor = (ColorPickerPreference) findPreference(PREF_QS_STROKE_COLOR);
    mQSStrokeColor.setOnPreferenceChangeListener(this);
    int qSIntColor = Settings.System.getInt(resolver, Settings.System.QS_STROKE_COLOR, DEFAULT_QS_STROKE_COLOR);
    String qSHexColor = String.format("#%08x", (0x4285F4 & qSIntColor));
    mQSStrokeColor.setSummary(qSHexColor);
    mQSStrokeColor.setNewPreviewColor(qSIntColor);
    // QS stroke thickness
    mQSStrokeThickness = (SeekBarPreference) findPreference(PREF_QS_STROKE_THICKNESS);
    int qSStrokeThickness = Settings.System.getInt(resolver, Settings.System.QS_STROKE_THICKNESS, 4);
    mQSStrokeThickness.setValue(qSStrokeThickness / 1);
    mQSStrokeThickness.setOnPreferenceChangeListener(this);
    // QS corner radius
    mQSCornerRadius = (SeekBarPreference) findPreference(PREF_QS_CORNER_RADIUS);
    int qSCornerRadius = Settings.System.getInt(resolver, Settings.System.QS_CORNER_RADIUS, 5);
    mQSCornerRadius.setValue(qSCornerRadius / 1);
    mQSCornerRadius.setOnPreferenceChangeListener(this);
    // QS dash width
    mQSDashWidth = (SeekBarPreference) findPreference(PREF_QS_STROKE_DASH_WIDTH);
    int qSDialogDashWidth = Settings.System.getInt(resolver, Settings.System.QS_STROKE_DASH_WIDTH, 0);
    if (qSDialogDashWidth != 0) {
        mQSDashWidth.setValue(qSDialogDashWidth / 1);
    } else {
        mQSDashWidth.setValue(0);
    }
    mQSDashWidth.setOnPreferenceChangeListener(this);
    // QS dash gap
    mQSDashGap = (SeekBarPreference) findPreference(PREF_QS_STROKE_DASH_GAP);
    int qSDialogDashGap = Settings.System.getInt(resolver, Settings.System.QS_STROKE_DASH_GAP, 10);
    mQSDashGap.setValue(qSDialogDashGap / 1);
    mQSDashGap.setOnPreferenceChangeListener(this);
    // Notifications alpha
    /*mNotificationsAlpha =
                    (SeekBarPreference) prefSet.findPreference(PREF_NOTIFICATION_ALPHA);
            int notificationsAlpha = Settings.System.getInt(resolver,
                    Settings.System.NOTIFICATION_ALPHA, 255);
            mNotificationsAlpha.setValue(notificationsAlpha / 1);
            mNotificationsAlpha.setOnPreferenceChangeListener(this);*/
    QSSettingsDisabler(qSStroke);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) ContentResolver(android.content.ContentResolver)

Example 22 with ListPreference

use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TaskManagerSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.rr_tm_ui);
    final ContentResolver resolver = getContentResolver();
    final PreferenceScreen prefScreen = getPreferenceScreen();
    final Resources res = getResources();
    mKillButton = (ListPreference) findPreference(TM_KILL_BUTTON);
    mKillButton.setValue(String.valueOf(Settings.System.getInt(getContentResolver(), Settings.System.TASK_MANAGER_KILL_BUTTON, 0)));
    mKillButton.setSummary(mKillButton.getEntry());
    mKillButton.setOnPreferenceChangeListener(this);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) Resources(android.content.res.Resources) ContentResolver(android.content.ContentResolver)

Example 23 with ListPreference

use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class Ticker method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.ticker);
    PreferenceScreen prefSet = getPreferenceScreen();
    ContentResolver resolver = getActivity().getContentResolver();
    mShowTicker = (ListPreference) findPreference(PREF_SHOW_TICKER);
    mShowTicker.setOnPreferenceChangeListener(this);
    int tickerMode = Settings.System.getIntForUser(getContentResolver(), Settings.System.STATUS_BAR_SHOW_TICKER, 0, UserHandle.USER_CURRENT);
    mShowTicker.setValue(String.valueOf(tickerMode));
    mShowTicker.setSummary(mShowTicker.getEntry());
    mTextColor = (ColorPickerPreference) prefSet.findPreference(PREF_TEXT_COLOR);
    mTextColor.setOnPreferenceChangeListener(this);
    int textColor = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_TICKER_TEXT_COLOR, 0xffffffff);
    String textHexColor = String.format("#%08x", (0xffffffff & textColor));
    mTextColor.setSummary(textHexColor);
    mTextColor.setNewPreviewColor(textColor);
    mIconColor = (ColorPickerPreference) prefSet.findPreference(PREF_ICON_COLOR);
    mIconColor.setOnPreferenceChangeListener(this);
    int iconColor = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_TICKER_ICON_COLOR, 0xffffffff);
    String iconHexColor = String.format("#%08x", (0xffffffff & iconColor));
    mIconColor.setSummary(iconHexColor);
    mIconColor.setNewPreviewColor(iconColor);
    mTickerDefaults = prefSet.findPreference(PREF_TICKER_RESTORE_DEFAULTS);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) ContentResolver(android.content.ContentResolver)

Example 24 with ListPreference

use of android.support.v7.preference.ListPreference 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 25 with ListPreference

use of android.support.v7.preference.ListPreference 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)

Aggregations

PreferenceScreen (android.support.v7.preference.PreferenceScreen)24 ListPreference (android.support.v7.preference.ListPreference)19 ContentResolver (android.content.ContentResolver)15 Preference (android.support.v7.preference.Preference)11 SwitchPreference (android.support.v14.preference.SwitchPreference)9 Resources (android.content.res.Resources)8 Context (android.content.Context)5 Intent (android.content.Intent)5 Activity (android.app.Activity)3 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)3 RestrictionEntry (android.content.RestrictionEntry)2 MultiSelectListPreference (android.support.v14.preference.MultiSelectListPreference)2 CheckBoxPreference (android.support.v7.preference.CheckBoxPreference)2 PreferenceCategory (android.support.v7.preference.PreferenceCategory)2 View (android.view.View)2 HashSet (java.util.HashSet)2 UiModeManager (android.app.UiModeManager)1 BluetoothAdapter (android.bluetooth.BluetoothAdapter)1 BluetoothPan (android.bluetooth.BluetoothPan)1 IntentFilter (android.content.IntentFilter)1