Search in sources :

Example 6 with ScheduleInfo

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);
}
Also used : AutomaticZenRule(android.app.AutomaticZenRule) ZenRule(android.service.notification.ZenModeConfig.ZenRule) ScheduleInfo(android.service.notification.ZenModeConfig.ScheduleInfo)

Example 7 with ScheduleInfo

use of android.service.notification.ZenModeConfig.ScheduleInfo in project platform_frameworks_base by android.

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);
}
Also used : AutomaticZenRule(android.app.AutomaticZenRule) ZenRule(android.service.notification.ZenModeConfig.ZenRule) ScheduleInfo(android.service.notification.ZenModeConfig.ScheduleInfo)

Example 8 with ScheduleInfo

use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by DirtyUnicorns.

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;
}
Also used : ScheduleInfo(android.service.notification.ZenModeConfig.ScheduleInfo)

Example 9 with ScheduleInfo

use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by AOSPA.

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;
}
Also used : ScheduleInfo(android.service.notification.ZenModeConfig.ScheduleInfo)

Example 10 with ScheduleInfo

use of android.service.notification.ZenModeConfig.ScheduleInfo in project android_frameworks_base by AOSPA.

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);
}
Also used : AutomaticZenRule(android.app.AutomaticZenRule) ZenRule(android.service.notification.ZenModeConfig.ZenRule) ScheduleInfo(android.service.notification.ZenModeConfig.ScheduleInfo)

Aggregations

ScheduleInfo (android.service.notification.ZenModeConfig.ScheduleInfo)10 AutomaticZenRule (android.app.AutomaticZenRule)5 ZenRule (android.service.notification.ZenModeConfig.ZenRule)5