Merge "Add onPreferenceClickListener to dnd schedule"

This commit is contained in:
TreeHugger Robot
2019-02-22 16:30:34 +00:00
committed by Android (Google) Code Review

View File

@@ -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;