Search in sources :

Example 31 with PreferenceScreen

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

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

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

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

the class ApnSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getEmptyTextView().setText(R.string.apn_settings_not_available);
    mUnavailable = isUiRestricted();
    setHasOptionsMenu(!mUnavailable);
    if (mUnavailable) {
        setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
        getPreferenceScreen().removeAll();
        return;
    }
    addPreferencesFromResource(R.xml.apn_settings);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen)

Example 35 with PreferenceScreen

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

the class ScreenPinningSettings method updateDisplay.

public void updateDisplay() {
    PreferenceScreen root = getPreferenceScreen();
    if (root != null) {
        root.removeAll();
    }
    if (isLockToAppEnabled(getActivity())) {
        addPreferencesFromResource(R.xml.screen_pinning_settings);
        root = getPreferenceScreen();
        mUseScreenLock = (SwitchPreference) root.findPreference(KEY_USE_SCREEN_LOCK);
        mUseScreenLock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                return setScreenLockUsed((boolean) newValue);
            }
        });
        mUseScreenLock.setChecked(isScreenLockUsed());
        mUseScreenLock.setTitle(getCurrentSecurityTitle());
    }
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) OnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener)

Aggregations

PreferenceScreen (android.support.v7.preference.PreferenceScreen)640 Preference (android.support.v7.preference.Preference)458 Context (android.content.Context)127 Test (org.junit.Test)126 SwitchPreference (android.support.v14.preference.SwitchPreference)96 PreferenceCategory (android.support.v7.preference.PreferenceCategory)82 Intent (android.content.Intent)63 PreferenceGroup (android.support.v7.preference.PreferenceGroup)58 VisibleForTesting (android.support.annotation.VisibleForTesting)55 PreferenceManager (android.support.v7.preference.PreferenceManager)54 ContentResolver (android.content.ContentResolver)53 PackageManager (android.content.pm.PackageManager)51 StorageItemPreference (com.android.settings.deviceinfo.StorageItemPreference)48 Bundle (android.os.Bundle)46 ArrayList (java.util.ArrayList)46 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)44 ListPreference (android.support.v7.preference.ListPreference)41 ComponentName (android.content.ComponentName)31 Resources (android.content.res.Resources)30 VolumeInfo (android.os.storage.VolumeInfo)30