Settings: Calendar event zen rule string updates.
- Remove Attendance option. - Use new reply value, tweak wording and summaries. Bug: 20064962 Change-Id: I6977b494e54752fa87ea08df0ed085129a09a3d3
This commit is contained in:
@@ -6104,51 +6104,36 @@
|
|||||||
<string name="zen_event_rule_enabled_toast">Automatic rule set to turn on Do Not Disturb during specified events</string>
|
<string name="zen_event_rule_enabled_toast">Automatic rule set to turn on Do Not Disturb during specified events</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule calendar option title -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule calendar option title -->
|
||||||
<string name="zen_mode_event_rule_calendar">Calendar</string>
|
<string name="zen_mode_event_rule_calendar">During events for</string>
|
||||||
|
|
||||||
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: During events for -->
|
||||||
|
<string name="zen_mode_event_rule_summary_calendar_template">During events for <xliff:g id="calendar" example="any calendar">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: any calendar -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: any calendar -->
|
||||||
<string name="zen_mode_event_rule_summary_any_calendar">Any calendar</string>
|
<string name="zen_mode_event_rule_summary_any_calendar">any calendar</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: any reply -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: Where reply is -->
|
||||||
<string name="zen_mode_event_rule_summary_any_reply">Any reply</string>
|
<string name="zen_mode_event_rule_summary_reply_template">Where reply is <xliff:g id="reply" example="Yes, Maybe, or Not replied">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: any reply except no -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule calendar option value for any calendar -->
|
||||||
<string name="zen_mode_event_rule_summary_any_reply_except_no">Any reply except no</string>
|
<string name="zen_mode_event_rule_calendar_any">Any calendar</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: replied yes -->
|
|
||||||
<string name="zen_mode_event_rule_summary_replied_yes">Replied yes</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule calendar option value for any calendar-->
|
|
||||||
<string name="zen_mode_event_rule_calendar_any">Any</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule attendance option title -->
|
|
||||||
<string name="zen_mode_event_rule_attendance">Attendance</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule attendance option value: required or optional -->
|
|
||||||
<string name="zen_mode_event_rule_attendance_required_optional">Required or optional</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule attendance option value: required -->
|
|
||||||
<string name="zen_mode_event_rule_attendance_required">Required</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule attendance option value: optional -->
|
|
||||||
<string name="zen_mode_event_rule_attendance_optional">Optional</string>
|
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option title -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option title -->
|
||||||
<string name="zen_mode_event_rule_reply">Reply</string>
|
<string name="zen_mode_event_rule_reply">Where reply is</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Any -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Yes, Maybe, or Not replied -->
|
||||||
<string name="zen_mode_event_rule_reply_any">Any</string>
|
<string name="zen_mode_event_rule_reply_any_except_no">Yes, Maybe, or Not replied</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Any except no-->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Yes or Maybe -->
|
||||||
<string name="zen_mode_event_rule_reply_any_except_no">Any except no</string>
|
<string name="zen_mode_event_rule_reply_yes_or_maybe">Yes or Maybe</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Yes -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Yes -->
|
||||||
<string name="zen_mode_event_rule_reply_yes">Yes</string>
|
<string name="zen_mode_event_rule_reply_yes">Yes</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Text to display if rule isn't found -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Text to display if rule isn't found -->
|
||||||
<string name="zen_mode_rule_not_found_text">Rule not found.</string>
|
<string name="zen_mode_rule_not_found_text">Rule not found.</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Rule summary template (when enabled) -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Rule summary template (when enabled) -->
|
||||||
<string name="zen_mode_rule_summary_combination"><xliff:g id="description" example="Sun - Thu">%1$s</xliff:g> / <xliff:g id="mode" example="Alarms only">%2$s</xliff:g></string>
|
<string name="zen_mode_rule_summary_combination"><xliff:g id="description" example="Sun - Thu">%1$s</xliff:g> / <xliff:g id="mode" example="Alarms only">%2$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Time-based rule days option title -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Time-based rule days option title -->
|
||||||
|
@@ -24,19 +24,13 @@
|
|||||||
android:title="@string/zen_mode_rule_name"
|
android:title="@string/zen_mode_rule_name"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<!-- Calendar -->
|
<!-- During events for -->
|
||||||
<com.android.settings.DropDownPreference
|
<com.android.settings.DropDownPreference
|
||||||
android:key="calendar"
|
android:key="calendar"
|
||||||
android:title="@string/zen_mode_event_rule_calendar"
|
android:title="@string/zen_mode_event_rule_calendar"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<!-- Attendance -->
|
<!-- Where reply is -->
|
||||||
<com.android.settings.DropDownPreference
|
|
||||||
android:key="attendance"
|
|
||||||
android:title="@string/zen_mode_event_rule_attendance"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<!-- Reply -->
|
|
||||||
<com.android.settings.DropDownPreference
|
<com.android.settings.DropDownPreference
|
||||||
android:key="reply"
|
android:key="reply"
|
||||||
android:title="@string/zen_mode_event_rule_reply"
|
android:title="@string/zen_mode_event_rule_reply"
|
||||||
|
@@ -202,11 +202,11 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String computeEventRuleSummary(EventInfo event) {
|
private String computeEventRuleSummary(EventInfo event) {
|
||||||
final String calendar = computeCalendarName(event);
|
final String calendar = getString(R.string.zen_mode_event_rule_summary_calendar_template,
|
||||||
final String attendance = getString(computeAttendance(event));
|
computeCalendarName(event));
|
||||||
final String reply = getString(computeReply(event));
|
final String reply = getString(R.string.zen_mode_event_rule_summary_reply_template,
|
||||||
return getString(R.string.zen_mode_rule_summary_combination,
|
getString(computeReply(event)));
|
||||||
getString(R.string.zen_mode_rule_summary_combination, calendar, attendance), reply);
|
return getString(R.string.zen_mode_rule_summary_combination, calendar, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String computeCalendarName(EventInfo event) {
|
private String computeCalendarName(EventInfo event) {
|
||||||
@@ -222,25 +222,16 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase {
|
|||||||
return getString(R.string.zen_mode_event_rule_summary_any_calendar);
|
return getString(R.string.zen_mode_event_rule_summary_any_calendar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeAttendance(EventInfo event) {
|
|
||||||
switch (event.attendance) {
|
|
||||||
case EventInfo.ATTENDANCE_REQUIRED:
|
|
||||||
return R.string.zen_mode_event_rule_attendance_required;
|
|
||||||
case EventInfo.ATTENDANCE_OPTIONAL:
|
|
||||||
return R.string.zen_mode_event_rule_attendance_optional;
|
|
||||||
default:
|
|
||||||
return R.string.zen_mode_event_rule_attendance_required_optional;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int computeReply(EventInfo event) {
|
private int computeReply(EventInfo event) {
|
||||||
switch (event.reply) {
|
switch (event.reply) {
|
||||||
case EventInfo.REPLY_ANY_EXCEPT_NO:
|
case EventInfo.REPLY_ANY_EXCEPT_NO:
|
||||||
return R.string.zen_mode_event_rule_summary_any_reply_except_no;
|
return R.string.zen_mode_event_rule_reply_any_except_no;
|
||||||
case EventInfo.REPLY_YES:
|
case EventInfo.REPLY_YES:
|
||||||
return R.string.zen_mode_event_rule_summary_replied_yes;
|
return R.string.zen_mode_event_rule_reply_yes;
|
||||||
|
case EventInfo.REPLY_YES_OR_MAYBE:
|
||||||
|
return R.string.zen_mode_event_rule_reply_yes_or_maybe;
|
||||||
default:
|
default:
|
||||||
return R.string.zen_mode_event_rule_summary_any_reply;
|
throw new IllegalArgumentException("Bad reply: " + event.reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,13 +31,11 @@ import com.android.settings.R;
|
|||||||
|
|
||||||
public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
|
public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
|
||||||
private static final String KEY_CALENDAR = "calendar";
|
private static final String KEY_CALENDAR = "calendar";
|
||||||
private static final String KEY_ATTENDANCE = "attendance";
|
|
||||||
private static final String KEY_REPLY = "reply";
|
private static final String KEY_REPLY = "reply";
|
||||||
|
|
||||||
public static final String ACTION = Settings.ACTION_ZEN_MODE_EVENT_RULE_SETTINGS;
|
public static final String ACTION = Settings.ACTION_ZEN_MODE_EVENT_RULE_SETTINGS;
|
||||||
|
|
||||||
private DropDownPreference mCalendar;
|
private DropDownPreference mCalendar;
|
||||||
private DropDownPreference mAttendance;
|
|
||||||
private DropDownPreference mReply;
|
private DropDownPreference mReply;
|
||||||
|
|
||||||
private EventInfo mEvent;
|
private EventInfo mEvent;
|
||||||
@@ -92,29 +90,11 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mAttendance = (DropDownPreference) root.findPreference(KEY_ATTENDANCE);
|
|
||||||
mAttendance.addItem(R.string.zen_mode_event_rule_attendance_required_optional,
|
|
||||||
EventInfo.ATTENDANCE_REQUIRED_OR_OPTIONAL);
|
|
||||||
mAttendance.addItem(R.string.zen_mode_event_rule_attendance_required,
|
|
||||||
EventInfo.ATTENDANCE_REQUIRED);
|
|
||||||
mAttendance.addItem(R.string.zen_mode_event_rule_attendance_optional,
|
|
||||||
EventInfo.ATTENDANCE_OPTIONAL);
|
|
||||||
mAttendance.setCallback(new DropDownPreference.Callback() {
|
|
||||||
@Override
|
|
||||||
public boolean onItemSelected(int pos, Object value) {
|
|
||||||
final int attendance = (Integer) value;
|
|
||||||
if (attendance == mEvent.attendance) return true;
|
|
||||||
mEvent.attendance = attendance;
|
|
||||||
updateRule(ZenModeConfig.toEventConditionId(mEvent));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mReply = (DropDownPreference) root.findPreference(KEY_REPLY);
|
mReply = (DropDownPreference) root.findPreference(KEY_REPLY);
|
||||||
mReply.addItem(R.string.zen_mode_event_rule_reply_any,
|
|
||||||
EventInfo.REPLY_ANY);
|
|
||||||
mReply.addItem(R.string.zen_mode_event_rule_reply_any_except_no,
|
mReply.addItem(R.string.zen_mode_event_rule_reply_any_except_no,
|
||||||
EventInfo.REPLY_ANY_EXCEPT_NO);
|
EventInfo.REPLY_ANY_EXCEPT_NO);
|
||||||
|
mReply.addItem(R.string.zen_mode_event_rule_reply_yes_or_maybe,
|
||||||
|
EventInfo.REPLY_YES_OR_MAYBE);
|
||||||
mReply.addItem(R.string.zen_mode_event_rule_reply_yes,
|
mReply.addItem(R.string.zen_mode_event_rule_reply_yes,
|
||||||
EventInfo.REPLY_YES);
|
EventInfo.REPLY_YES);
|
||||||
mReply.setCallback(new DropDownPreference.Callback() {
|
mReply.setCallback(new DropDownPreference.Callback() {
|
||||||
@@ -135,7 +115,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateControlsInternal() {
|
protected void updateControlsInternal() {
|
||||||
mCalendar.setSelectedValue(mEvent.calendar);
|
mCalendar.setSelectedValue(mEvent.calendar);
|
||||||
mAttendance.setSelectedValue(mEvent.attendance);
|
|
||||||
mReply.setSelectedValue(mEvent.reply);
|
mReply.setSelectedValue(mEvent.reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -166,7 +166,6 @@ public abstract class ZenRuleNameDialog {
|
|||||||
private static RuleInfo defaultNewEvent() {
|
private static RuleInfo defaultNewEvent() {
|
||||||
final EventInfo event = new EventInfo();
|
final EventInfo event = new EventInfo();
|
||||||
event.calendar = 0; // any
|
event.calendar = 0; // any
|
||||||
event.attendance = EventInfo.ATTENDANCE_REQUIRED_OR_OPTIONAL;
|
|
||||||
event.reply = EventInfo.REPLY_ANY_EXCEPT_NO;
|
event.reply = EventInfo.REPLY_ANY_EXCEPT_NO;
|
||||||
final RuleInfo rt = new RuleInfo();
|
final RuleInfo rt = new RuleInfo();
|
||||||
rt.settingsAction = ZenModeEventRuleSettings.ACTION;
|
rt.settingsAction = ZenModeEventRuleSettings.ACTION;
|
||||||
|
Reference in New Issue
Block a user