Search in sources :

Example 1 with OnBeforeCheckedChangeListener

use of com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ToggleAccessibilityServicePreferenceFragment method onInstallSwitchBarToggleSwitch.

@Override
protected void onInstallSwitchBarToggleSwitch() {
    super.onInstallSwitchBarToggleSwitch();
    mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {

        @Override
        public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
            if (checked) {
                mSwitchBar.setCheckedInternal(false);
                getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, false);
                showDialog(DIALOG_ID_ENABLE_WARNING);
            } else {
                mSwitchBar.setCheckedInternal(true);
                getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, true);
                showDialog(DIALOG_ID_DISABLE_WARNING);
            }
            return true;
        }
    });
}
Also used : ToggleSwitch(com.android.settings.widget.ToggleSwitch) OnBeforeCheckedChangeListener(com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener)

Example 2 with OnBeforeCheckedChangeListener

use of com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ToggleGlobalGesturePreferenceFragment method onInstallSwitchBarToggleSwitch.

@Override
protected void onInstallSwitchBarToggleSwitch() {
    super.onInstallSwitchBarToggleSwitch();
    mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {

        @Override
        public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
            mSwitchBar.setCheckedInternal(checked);
            getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
            onPreferenceToggled(mPreferenceKey, checked);
            return false;
        }
    });
}
Also used : ToggleSwitch(com.android.settings.widget.ToggleSwitch) OnBeforeCheckedChangeListener(com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener)

Example 3 with OnBeforeCheckedChangeListener

use of com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ToggleScreenMagnificationPreferenceFragment method onInstallSwitchBarToggleSwitch.

@Override
protected void onInstallSwitchBarToggleSwitch() {
    super.onInstallSwitchBarToggleSwitch();
    mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {

        @Override
        public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
            mSwitchBar.setCheckedInternal(checked);
            getArguments().putBoolean(AccessibilitySettings.EXTRA_CHECKED, checked);
            onPreferenceToggled(mPreferenceKey, checked);
            return false;
        }
    });
}
Also used : ToggleSwitch(com.android.settings.widget.ToggleSwitch) OnBeforeCheckedChangeListener(com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener)

Aggregations

ToggleSwitch (com.android.settings.widget.ToggleSwitch)3 OnBeforeCheckedChangeListener (com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener)3