use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeRepeatCallersPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
SwitchPreference pref = (SwitchPreference) preference;
switch(getZenMode()) {
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
case Settings.Global.ZEN_MODE_ALARMS:
pref.setEnabled(false);
pref.setChecked(false);
break;
default:
boolean anyCallersCanBypassDnd = (mBackend.isPriorityCategoryEnabled(Policy.PRIORITY_CATEGORY_CALLS) && mBackend.getPriorityCallSenders() == Policy.PRIORITY_SENDERS_ANY);
// if any caller can bypass dnd then repeat callers preference is disabled
if (anyCallersCanBypassDnd) {
pref.setEnabled(false);
pref.setChecked(true);
} else {
pref.setEnabled(true);
pref.setChecked(mBackend.isPriorityCategoryEnabled(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS));
}
}
}
use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeEventsPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
SwitchPreference pref = (SwitchPreference) preference;
switch(getZenMode()) {
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
case Settings.Global.ZEN_MODE_ALARMS:
pref.setEnabled(false);
pref.setChecked(false);
break;
default:
pref.setChecked(mBackend.isPriorityCategoryEnabled(Policy.PRIORITY_CATEGORY_EVENTS));
pref.setEnabled(true);
}
}
use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeRemindersPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
SwitchPreference pref = (SwitchPreference) preference;
switch(getZenMode()) {
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
case Settings.Global.ZEN_MODE_ALARMS:
pref.setEnabled(false);
pref.setChecked(false);
break;
default:
pref.setEnabled(true);
pref.setChecked(mBackend.isPriorityCategoryEnabled(NotificationManager.Policy.PRIORITY_CATEGORY_REMINDERS));
}
}
use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeSystemPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
SwitchPreference pref = (SwitchPreference) preference;
switch(getZenMode()) {
case Settings.Global.ZEN_MODE_NO_INTERRUPTIONS:
pref.setEnabled(false);
pref.setChecked(false);
break;
case Settings.Global.ZEN_MODE_ALARMS:
pref.setEnabled(false);
pref.setChecked(false);
break;
default:
pref.setEnabled(true);
pref.setChecked(mBackend.isPriorityCategoryEnabled(Policy.PRIORITY_CATEGORY_SYSTEM));
}
}
use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.
the class ZenRuleCustomSwitchPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (mRule == null || mRule.getZenPolicy() == null) {
return;
}
SwitchPreference pref = (SwitchPreference) preference;
pref.setChecked(mRule.getZenPolicy().isCategoryAllowed(mCategory, false));
}
Aggregations