Loading src/com/android/settings/notification/ZenModeAutomationSettings.java +2 −7 Original line number Diff line number Diff line Loading @@ -214,13 +214,8 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase { } private String computeCalendarName(EventInfo event) { if (event.calendar != EventInfo.ANY_CALENDAR) { final CalendarInfo calendar = ZenModeEventRuleSettings.findCalendar(mContext, event); if (calendar != null) { return calendar.name; } } return getString(R.string.zen_mode_event_rule_summary_any_calendar); return event.calendar != null ? event.calendar : getString(R.string.zen_mode_event_rule_summary_any_calendar); } private int computeReply(EventInfo event) { Loading src/com/android/settings/notification/ZenModeEventRuleSettings.java +16 −9 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.settings.notification; import static android.service.notification.ZenModeConfig.EventInfo.ANY_CALENDAR; import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.database.Cursor; Loading Loading @@ -81,9 +79,17 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { private void reloadCalendar() { mCalendars = getCalendars(mContext); mCalendar.clearItems(); mCalendar.addItem(R.string.zen_mode_event_rule_calendar_any, key(0, ANY_CALENDAR)); mCalendar.addItem(R.string.zen_mode_event_rule_calendar_any, key(0, null)); final String eventCalendar = mEvent != null ? mEvent.calendar : null; boolean found = false; for (CalendarInfo calendar : mCalendars) { mCalendar.addItem(calendar.name, key(calendar)); if (eventCalendar != null && eventCalendar.equals(calendar.name)) { found = true; } } if (eventCalendar != null && !found) { mCalendar.addItem(eventCalendar, key(mEvent.userId, eventCalendar)); } } Loading @@ -101,7 +107,10 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { if (calendarKey.equals(key(mEvent))) return true; final int i = calendarKey.indexOf(':'); mEvent.userId = Integer.parseInt(calendarKey.substring(0, i)); mEvent.calendar = Long.parseLong(calendarKey.substring(i + 1)); mEvent.calendar = calendarKey.substring(i + 1); if (mEvent.calendar.isEmpty()) { mEvent.calendar = null; } updateRule(ZenModeConfig.toEventConditionId(mEvent)); return true; } Loading Loading @@ -185,7 +194,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { } while (cursor.moveToNext()) { final CalendarInfo ci = new CalendarInfo(); ci.id = cursor.getLong(0); ci.name = cursor.getString(1); ci.userId = context.getUserId(); outCalendars.add(ci); Loading @@ -198,15 +206,15 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { } private static String key(CalendarInfo calendar) { return key(calendar.userId, calendar.id); return key(calendar.userId, calendar.name); } private static String key(EventInfo event) { return key(event.userId, event.calendar); } private static String key(int userId, long calendarId) { return EventInfo.resolveUserId(userId) + ":" + calendarId; private static String key(int userId, String calendar) { return EventInfo.resolveUserId(userId) + ":" + (calendar == null ? "" : calendar); } private static final Comparator<CalendarInfo> CALENDAR_NAME = new Comparator<CalendarInfo>() { Loading @@ -217,7 +225,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { }; public static class CalendarInfo { public long id; public String name; public int userId; } Loading src/com/android/settings/notification/ZenRuleNameDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public abstract class ZenRuleNameDialog { private static RuleInfo defaultNewEvent() { final EventInfo event = new EventInfo(); event.calendar = EventInfo.ANY_CALENDAR; event.calendar = null; // any calendar event.reply = EventInfo.REPLY_ANY_EXCEPT_NO; final RuleInfo rt = new RuleInfo(); rt.settingsAction = ZenModeEventRuleSettings.ACTION; Loading Loading
src/com/android/settings/notification/ZenModeAutomationSettings.java +2 −7 Original line number Diff line number Diff line Loading @@ -214,13 +214,8 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase { } private String computeCalendarName(EventInfo event) { if (event.calendar != EventInfo.ANY_CALENDAR) { final CalendarInfo calendar = ZenModeEventRuleSettings.findCalendar(mContext, event); if (calendar != null) { return calendar.name; } } return getString(R.string.zen_mode_event_rule_summary_any_calendar); return event.calendar != null ? event.calendar : getString(R.string.zen_mode_event_rule_summary_any_calendar); } private int computeReply(EventInfo event) { Loading
src/com/android/settings/notification/ZenModeEventRuleSettings.java +16 −9 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.settings.notification; import static android.service.notification.ZenModeConfig.EventInfo.ANY_CALENDAR; import android.content.Context; import android.content.pm.PackageManager.NameNotFoundException; import android.database.Cursor; Loading Loading @@ -81,9 +79,17 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { private void reloadCalendar() { mCalendars = getCalendars(mContext); mCalendar.clearItems(); mCalendar.addItem(R.string.zen_mode_event_rule_calendar_any, key(0, ANY_CALENDAR)); mCalendar.addItem(R.string.zen_mode_event_rule_calendar_any, key(0, null)); final String eventCalendar = mEvent != null ? mEvent.calendar : null; boolean found = false; for (CalendarInfo calendar : mCalendars) { mCalendar.addItem(calendar.name, key(calendar)); if (eventCalendar != null && eventCalendar.equals(calendar.name)) { found = true; } } if (eventCalendar != null && !found) { mCalendar.addItem(eventCalendar, key(mEvent.userId, eventCalendar)); } } Loading @@ -101,7 +107,10 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { if (calendarKey.equals(key(mEvent))) return true; final int i = calendarKey.indexOf(':'); mEvent.userId = Integer.parseInt(calendarKey.substring(0, i)); mEvent.calendar = Long.parseLong(calendarKey.substring(i + 1)); mEvent.calendar = calendarKey.substring(i + 1); if (mEvent.calendar.isEmpty()) { mEvent.calendar = null; } updateRule(ZenModeConfig.toEventConditionId(mEvent)); return true; } Loading Loading @@ -185,7 +194,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { } while (cursor.moveToNext()) { final CalendarInfo ci = new CalendarInfo(); ci.id = cursor.getLong(0); ci.name = cursor.getString(1); ci.userId = context.getUserId(); outCalendars.add(ci); Loading @@ -198,15 +206,15 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { } private static String key(CalendarInfo calendar) { return key(calendar.userId, calendar.id); return key(calendar.userId, calendar.name); } private static String key(EventInfo event) { return key(event.userId, event.calendar); } private static String key(int userId, long calendarId) { return EventInfo.resolveUserId(userId) + ":" + calendarId; private static String key(int userId, String calendar) { return EventInfo.resolveUserId(userId) + ":" + (calendar == null ? "" : calendar); } private static final Comparator<CalendarInfo> CALENDAR_NAME = new Comparator<CalendarInfo>() { Loading @@ -217,7 +225,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase { }; public static class CalendarInfo { public long id; public String name; public int userId; } Loading
src/com/android/settings/notification/ZenRuleNameDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public abstract class ZenRuleNameDialog { private static RuleInfo defaultNewEvent() { final EventInfo event = new EventInfo(); event.calendar = EventInfo.ANY_CALENDAR; event.calendar = null; // any calendar event.reply = EventInfo.REPLY_ANY_EXCEPT_NO; final RuleInfo rt = new RuleInfo(); rt.settingsAction = ZenModeEventRuleSettings.ACTION; Loading