use of android.app.AutomaticZenRule in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeSettingsBase method addZenRule.
protected String addZenRule(AutomaticZenRule rule) {
try {
String id = NotificationManager.from(mContext).addAutomaticZenRule(rule);
final AutomaticZenRule savedRule = NotificationManager.from(mContext).getAutomaticZenRule(id);
maybeRefreshRules(savedRule != null, true);
return id;
} catch (Exception e) {
return null;
}
}
use of android.app.AutomaticZenRule in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeAutomationSettings method updateControls.
private void updateControls() {
final PreferenceScreen root = getPreferenceScreen();
root.removeAll();
final Map.Entry<String, AutomaticZenRule>[] sortedRules = sortedRules();
for (Map.Entry<String, AutomaticZenRule> sortedRule : sortedRules) {
ZenRulePreference pref = new ZenRulePreference(getPrefContext(), sortedRule);
if (pref.appExists) {
root.addPreference(pref);
}
}
final Preference p = new Preference(getPrefContext());
p.setIcon(R.drawable.ic_add);
p.setTitle(R.string.zen_mode_add_rule);
p.setPersistent(false);
p.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ADD_RULE);
showAddRuleDialog();
return true;
}
});
root.addPreference(p);
}
Aggregations