use of android.service.notification.ZenModeConfig.ScheduleInfo in project platform_frameworks_base by android.
the class ScheduleConditionProvider method toScheduleCalendar.
private static ScheduleCalendar toScheduleCalendar(Uri conditionId) {
final ScheduleInfo schedule = ZenModeConfig.tryParseScheduleConditionId(conditionId);
if (schedule == null || schedule.days == null || schedule.days.length == 0)
return null;
final ScheduleCalendar sc = new ScheduleCalendar();
sc.setSchedule(schedule);
sc.setTimeZone(TimeZone.getDefault());
return sc;
}
use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by DirtyUnicorns.
the class ZenModeHelper method appendDefaultScheduleRules.
private void appendDefaultScheduleRules(ZenModeConfig config) {
if (config == null)
return;
final ScheduleInfo weeknights = new ScheduleInfo();
weeknights.days = ZenModeConfig.WEEKNIGHT_DAYS;
weeknights.startHour = 22;
weeknights.endHour = 7;
final ZenRule rule1 = new ZenRule();
rule1.enabled = false;
rule1.name = mContext.getResources().getString(R.string.zen_mode_default_weeknights_name);
rule1.conditionId = ZenModeConfig.toScheduleConditionId(weeknights);
rule1.zenMode = Global.ZEN_MODE_ALARMS;
rule1.component = ScheduleConditionProvider.COMPONENT;
rule1.id = ZenModeConfig.newRuleId();
rule1.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule1.id, rule1);
final ScheduleInfo weekends = new ScheduleInfo();
weekends.days = ZenModeConfig.WEEKEND_DAYS;
weekends.startHour = 23;
weekends.startMinute = 30;
weekends.endHour = 10;
final ZenRule rule2 = new ZenRule();
rule2.enabled = false;
rule2.name = mContext.getResources().getString(R.string.zen_mode_default_weekends_name);
rule2.conditionId = ZenModeConfig.toScheduleConditionId(weekends);
rule2.zenMode = Global.ZEN_MODE_ALARMS;
rule2.component = ScheduleConditionProvider.COMPONENT;
rule2.id = ZenModeConfig.newRuleId();
rule2.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule2.id, rule2);
}
use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by ResurrectionRemix.
the class ZenModeHelper method appendDefaultScheduleRules.
private void appendDefaultScheduleRules(ZenModeConfig config) {
if (config == null)
return;
final ScheduleInfo weeknights = new ScheduleInfo();
weeknights.days = ZenModeConfig.WEEKNIGHT_DAYS;
weeknights.startHour = 22;
weeknights.endHour = 7;
final ZenRule rule1 = new ZenRule();
rule1.enabled = false;
rule1.name = mContext.getResources().getString(R.string.zen_mode_default_weeknights_name);
rule1.conditionId = ZenModeConfig.toScheduleConditionId(weeknights);
rule1.zenMode = Global.ZEN_MODE_ALARMS;
rule1.component = ScheduleConditionProvider.COMPONENT;
rule1.id = ZenModeConfig.newRuleId();
rule1.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule1.id, rule1);
final ScheduleInfo weekends = new ScheduleInfo();
weekends.days = ZenModeConfig.WEEKEND_DAYS;
weekends.startHour = 23;
weekends.startMinute = 30;
weekends.endHour = 10;
final ZenRule rule2 = new ZenRule();
rule2.enabled = false;
rule2.name = mContext.getResources().getString(R.string.zen_mode_default_weekends_name);
rule2.conditionId = ZenModeConfig.toScheduleConditionId(weekends);
rule2.zenMode = Global.ZEN_MODE_ALARMS;
rule2.component = ScheduleConditionProvider.COMPONENT;
rule2.id = ZenModeConfig.newRuleId();
rule2.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule2.id, rule2);
}
use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by ResurrectionRemix.
the class ScheduleConditionProvider method toScheduleCalendar.
private static ScheduleCalendar toScheduleCalendar(Uri conditionId) {
final ScheduleInfo schedule = ZenModeConfig.tryParseScheduleConditionId(conditionId);
if (schedule == null || schedule.days == null || schedule.days.length == 0)
return null;
final ScheduleCalendar sc = new ScheduleCalendar();
sc.setSchedule(schedule);
sc.setTimeZone(TimeZone.getDefault());
return sc;
}
use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by crdroidandroid.
the class ZenModeHelper method appendDefaultScheduleRules.
private void appendDefaultScheduleRules(ZenModeConfig config) {
if (config == null)
return;
final ScheduleInfo weeknights = new ScheduleInfo();
weeknights.days = ZenModeConfig.WEEKNIGHT_DAYS;
weeknights.startHour = 22;
weeknights.endHour = 7;
final ZenRule rule1 = new ZenRule();
rule1.enabled = false;
rule1.name = mContext.getResources().getString(R.string.zen_mode_default_weeknights_name);
rule1.conditionId = ZenModeConfig.toScheduleConditionId(weeknights);
rule1.zenMode = Global.ZEN_MODE_ALARMS;
rule1.component = ScheduleConditionProvider.COMPONENT;
rule1.id = ZenModeConfig.newRuleId();
rule1.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule1.id, rule1);
final ScheduleInfo weekends = new ScheduleInfo();
weekends.days = ZenModeConfig.WEEKEND_DAYS;
weekends.startHour = 23;
weekends.startMinute = 30;
weekends.endHour = 10;
final ZenRule rule2 = new ZenRule();
rule2.enabled = false;
rule2.name = mContext.getResources().getString(R.string.zen_mode_default_weekends_name);
rule2.conditionId = ZenModeConfig.toScheduleConditionId(weekends);
rule2.zenMode = Global.ZEN_MODE_ALARMS;
rule2.component = ScheduleConditionProvider.COMPONENT;
rule2.id = ZenModeConfig.newRuleId();
rule2.creationTime = System.currentTimeMillis();
config.automaticRules.put(rule2.id, rule2);
}
Aggregations