Add onPreferenceClickListener to dnd schedule

- Talkback says the preference is clickable

Test: manual
Bug: 124827588
Change-Id: I1cf5ae564eb0a7ddfa60e1c307f00194f9338a13
This commit is contained in:
Beverly
2019-02-21 10:52:27 -05:00
parent 7e1bd433e6
commit 77f05fe793

View File

@@ -63,6 +63,11 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
mSwitchBar.setSwitchBarText(R.string.zen_mode_use_automatic_rule,
R.string.zen_mode_use_automatic_rule);
try {
pref.setOnPreferenceClickListener(preference -> {
mRule.setEnabled(!mRule.isEnabled());
mBackend.updateZenRule(mId, mRule);
return true;
});
mSwitchBar.addOnSwitchChangeListener(this);
} catch (IllegalStateException e) {
// 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) {
mRule = rule;
mId = id;