Search in sources :

Example 31 with CheckBoxPreference

use of android.support.v7.preference.CheckBoxPreference in project android_packages_apps_Settings by crdroidandroid.

the class ApplicationSettings method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.application_settings);
    mToggleAdvancedSettings = (CheckBoxPreference) findPreference(KEY_TOGGLE_ADVANCED_SETTINGS);
    mToggleAdvancedSettings.setChecked(isAdvancedSettingsEnabled());
    getPreferenceScreen().removePreference(mToggleAdvancedSettings);
    // not ready for prime time yet
    if (false) {
        getPreferenceScreen().removePreference(mInstallLocation);
    }
    mInstallLocation = (ListPreference) findPreference(KEY_APP_INSTALL_LOCATION);
    // Is app default install location set?
    boolean userSetInstLocation = (Settings.Global.getInt(getContentResolver(), Settings.Global.SET_INSTALL_LOCATION, 0) != 0);
    if (!userSetInstLocation) {
        getPreferenceScreen().removePreference(mInstallLocation);
    } else {
        mInstallLocation.setValue(getAppInstallLocation());
        mInstallLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

            public boolean onPreferenceChange(Preference preference, Object newValue) {
                String value = (String) newValue;
                handleUpdateAppInstallLocation(value);
                return false;
            }
        });
    }
}
Also used : Preference(android.support.v7.preference.Preference) CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) ListPreference(android.support.v7.preference.ListPreference) OnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener)

Example 32 with CheckBoxPreference

use of android.support.v7.preference.CheckBoxPreference in project sms-backup-plus by jberkel.

the class MainSettings method updateAutoBackupPreferences.

private void updateAutoBackupPreferences() {
    final CheckBoxPreference autoBackup = findAutoBackupPreference();
    autoBackup.setSummary(summarizeAutoBackupSettings());
    autoBackup.setEnabled(!authPreferences.useXOAuth() || authPreferences.hasOAuth2Tokens());
    final Preference autoBackupSettings = findPreference(BACKUP_SETTINGS_SCREEN.key);
    autoBackupSettings.setSummary(summarizeBackupScheduleSettings(autoBackup.isChecked()));
    autoBackupSettings.setEnabled(autoBackup.isEnabled() && autoBackup.isChecked());
}
Also used : CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) ListPreference(android.support.v7.preference.ListPreference) TwoStatePreference(android.support.v7.preference.TwoStatePreference) Preference(android.support.v7.preference.Preference)

Example 33 with CheckBoxPreference

use of android.support.v7.preference.CheckBoxPreference in project Pix-Art-Messenger by kriztan.

the class SettingsActivity method enableMultiAccounts.

private void enableMultiAccounts() {
    if (!isMultiAccountChecked) {
        multiAccountPreference.setEnabled(true);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(false);
        builder.setTitle(R.string.pref_enable_multi_accounts_title);
        builder.setMessage(R.string.pref_enable_multi_accounts_summary);
        builder.setNegativeButton(R.string.cancel, (dialog, which) -> {
            ((CheckBoxPreference) multiAccountPreference).setChecked(false);
        });
        builder.setPositiveButton(R.string.enter_password, (dialog, which) -> {
            ((CheckBoxPreference) multiAccountPreference).setChecked(false);
            enterPasswordDialog();
        });
        AlertDialog dialog = builder.create();
        dialog.show();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) CheckBoxPreference(android.preference.CheckBoxPreference)

Example 34 with CheckBoxPreference

use of android.support.v7.preference.CheckBoxPreference in project android_packages_apps_CMParts by LineageOS.

the class DisplayRotation method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.display_rotation);
    PreferenceScreen prefSet = getPreferenceScreen();
    mAccelerometer = (SwitchPreference) findPreference(KEY_ACCELEROMETER);
    mAccelerometer.setPersistent(false);
    mRotation0Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_0_PREF);
    mRotation90Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_90_PREF);
    mRotation180Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_180_PREF);
    mRotation270Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_270_PREF);
    int mode = Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION_ANGLES, ROTATION_0_MODE | ROTATION_90_MODE | ROTATION_270_MODE);
    mRotation0Pref.setChecked((mode & ROTATION_0_MODE) != 0);
    mRotation90Pref.setChecked((mode & ROTATION_90_MODE) != 0);
    mRotation180Pref.setChecked((mode & ROTATION_180_MODE) != 0);
    mRotation270Pref.setChecked((mode & ROTATION_270_MODE) != 0);
    watch(Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION));
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen)

Example 35 with CheckBoxPreference

use of android.support.v7.preference.CheckBoxPreference in project android_packages_apps_Settings by SudaMod.

the class ApplicationSettings method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.application_settings);
    mToggleAdvancedSettings = (CheckBoxPreference) findPreference(KEY_TOGGLE_ADVANCED_SETTINGS);
    mToggleAdvancedSettings.setChecked(isAdvancedSettingsEnabled());
    getPreferenceScreen().removePreference(mToggleAdvancedSettings);
    // not ready for prime time yet
    if (false) {
        getPreferenceScreen().removePreference(mInstallLocation);
    }
    mInstallLocation = (ListPreference) findPreference(KEY_APP_INSTALL_LOCATION);
    // Is app default install location set?
    boolean userSetInstLocation = (Settings.Global.getInt(getContentResolver(), Settings.Global.SET_INSTALL_LOCATION, 0) != 0);
    if (!userSetInstLocation) {
        getPreferenceScreen().removePreference(mInstallLocation);
    } else {
        mInstallLocation.setValue(getAppInstallLocation());
        mInstallLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

            public boolean onPreferenceChange(Preference preference, Object newValue) {
                String value = (String) newValue;
                handleUpdateAppInstallLocation(value);
                return false;
            }
        });
    }
}
Also used : Preference(android.support.v7.preference.Preference) CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) ListPreference(android.support.v7.preference.ListPreference) OnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener)

Aggregations

CheckBoxPreference (android.support.v7.preference.CheckBoxPreference)31 Preference (android.support.v7.preference.Preference)17 ListPreference (android.support.v7.preference.ListPreference)13 Intent (android.content.Intent)10 CheckBoxPreference (android.preference.CheckBoxPreference)8 Context (android.content.Context)7 SharedPreferences (android.content.SharedPreferences)7 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)7 Preference (android.preference.Preference)6 AlertDialog (android.support.v7.app.AlertDialog)6 PreferenceScreen (android.support.v7.preference.PreferenceScreen)5 SwitchPreferenceCompat (android.support.v7.preference.SwitchPreferenceCompat)5 Uri (android.net.Uri)4 Build (android.os.Build)4 PreferenceScreen (android.preference.PreferenceScreen)4 View (android.view.View)4 ArrayList (java.util.ArrayList)4 PackageManager (android.content.pm.PackageManager)3 Bundle (android.os.Bundle)3 ListPreference (android.preference.ListPreference)3