Merge "Add onPreferenceClickListener to dnd schedule"
This commit is contained in:
committed by
Android (Google) Code Review
commit
68e32cbd04
@@ -63,6 +63,11 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
|
|||||||
mSwitchBar.setSwitchBarText(R.string.zen_mode_use_automatic_rule,
|
mSwitchBar.setSwitchBarText(R.string.zen_mode_use_automatic_rule,
|
||||||
R.string.zen_mode_use_automatic_rule);
|
R.string.zen_mode_use_automatic_rule);
|
||||||
try {
|
try {
|
||||||
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
|
mRule.setEnabled(!mRule.isEnabled());
|
||||||
|
mBackend.updateZenRule(mId, mRule);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
mSwitchBar.addOnSwitchChangeListener(this);
|
mSwitchBar.addOnSwitchChangeListener(this);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
// an exception is thrown if you try to add the listener twice
|
// an exception is thrown if you try to add the listener twice
|
||||||
@@ -71,7 +76,6 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onResume(AutomaticZenRule rule, String id) {
|
public void onResume(AutomaticZenRule rule, String id) {
|
||||||
mRule = rule;
|
mRule = rule;
|
||||||
mId = id;
|
mId = id;
|
||||||
|
|||||||
Reference in New Issue
Block a user