summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2015-05-05 09:59:26 -0400
committerJohn Spurlock <jspurlock@google.com>2015-05-05 10:12:26 -0400
commit4b43b720544c556e4a8aca4e00a78ea1cd54160f (patch)
treeb0be12dceb77c57b37a0e75c2b297ef20fbedee1
parent0ab13b8326d6f31caff922fd95828254cb95a618 (diff)
downloadpackages_apps_Settings-4b43b720544c556e4a8aca4e00a78ea1cd54160f.zip
packages_apps_Settings-4b43b720544c556e4a8aca4e00a78ea1cd54160f.tar.gz
packages_apps_Settings-4b43b720544c556e4a8aca4e00a78ea1cd54160f.tar.bz2
Settings: Calendar event zen rule string updates.
- Remove Attendance option. - Use new reply value, tweak wording and summaries. Bug: 20064962 Change-Id: I6977b494e54752fa87ea08df0ed085129a09a3d3
-rw-r--r--res/values/strings.xml47
-rw-r--r--res/xml/zen_mode_event_rule_settings.xml10
-rw-r--r--src/com/android/settings/notification/ZenModeAutomationSettings.java29
-rw-r--r--src/com/android/settings/notification/ZenModeEventRuleSettings.java25
-rw-r--r--src/com/android/settings/notification/ZenRuleNameDialog.java1
5 files changed, 30 insertions, 82 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7e52036..ae8c8e4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6104,51 +6104,36 @@
<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 -->
- <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: any calendar -->
- <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 -->
- <string name="zen_mode_event_rule_summary_any_reply">Any reply</string>
-
- <!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule summary fragment: any reply except no -->
- <string name="zen_mode_event_rule_summary_any_reply_except_no">Any reply except no</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 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 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 summary fragment: any calendar -->
+ <string name="zen_mode_event_rule_summary_any_calendar">any calendar</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 summary fragment: Where reply is -->
+ <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 attendance option value: optional -->
- <string name="zen_mode_event_rule_attendance_optional">Optional</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 calendar</string>
<!-- [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 -->
- <string name="zen_mode_event_rule_reply_any">Any</string>
+ <!-- [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_except_no">Yes, Maybe, or Not replied</string>
- <!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Any except no-->
- <string name="zen_mode_event_rule_reply_any_except_no">Any except no</string>
+ <!-- [CHAR LIMIT=40] Zen mode settings: Event-based rule reply option value: Yes or Maybe -->
+ <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 -->
<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>
- <!-- [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>
<!-- [CHAR LIMIT=40] Zen mode settings: Time-based rule days option title -->
diff --git a/res/xml/zen_mode_event_rule_settings.xml b/res/xml/zen_mode_event_rule_settings.xml
index acad96c..2519fc1 100644
--- a/res/xml/zen_mode_event_rule_settings.xml
+++ b/res/xml/zen_mode_event_rule_settings.xml
@@ -24,19 +24,13 @@
android:title="@string/zen_mode_rule_name"
android:persistent="false" />
- <!-- Calendar -->
+ <!-- During events for -->
<com.android.settings.DropDownPreference
android:key="calendar"
android:title="@string/zen_mode_event_rule_calendar"
android:persistent="false" />
- <!-- Attendance -->
- <com.android.settings.DropDownPreference
- android:key="attendance"
- android:title="@string/zen_mode_event_rule_attendance"
- android:persistent="false" />
-
- <!-- Reply -->
+ <!-- Where reply is -->
<com.android.settings.DropDownPreference
android:key="reply"
android:title="@string/zen_mode_event_rule_reply"
diff --git a/src/com/android/settings/notification/ZenModeAutomationSettings.java b/src/com/android/settings/notification/ZenModeAutomationSettings.java
index e33e32f..9716998 100644
--- a/src/com/android/settings/notification/ZenModeAutomationSettings.java
+++ b/src/com/android/settings/notification/ZenModeAutomationSettings.java
@@ -202,11 +202,11 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase {
}
private String computeEventRuleSummary(EventInfo event) {
- final String calendar = computeCalendarName(event);
- final String attendance = getString(computeAttendance(event));
- final String reply = getString(computeReply(event));
- return getString(R.string.zen_mode_rule_summary_combination,
- getString(R.string.zen_mode_rule_summary_combination, calendar, attendance), reply);
+ final String calendar = getString(R.string.zen_mode_event_rule_summary_calendar_template,
+ computeCalendarName(event));
+ final String reply = getString(R.string.zen_mode_event_rule_summary_reply_template,
+ getString(computeReply(event)));
+ return getString(R.string.zen_mode_rule_summary_combination, calendar, reply);
}
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);
}
- 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) {
switch (event.reply) {
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:
- 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:
- return R.string.zen_mode_event_rule_summary_any_reply;
+ throw new IllegalArgumentException("Bad reply: " + event.reply);
}
}
diff --git a/src/com/android/settings/notification/ZenModeEventRuleSettings.java b/src/com/android/settings/notification/ZenModeEventRuleSettings.java
index 38581b6..29738b3 100644
--- a/src/com/android/settings/notification/ZenModeEventRuleSettings.java
+++ b/src/com/android/settings/notification/ZenModeEventRuleSettings.java
@@ -31,13 +31,11 @@ import com.android.settings.R;
public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
private static final String KEY_CALENDAR = "calendar";
- private static final String KEY_ATTENDANCE = "attendance";
private static final String KEY_REPLY = "reply";
public static final String ACTION = Settings.ACTION_ZEN_MODE_EVENT_RULE_SETTINGS;
private DropDownPreference mCalendar;
- private DropDownPreference mAttendance;
private DropDownPreference mReply;
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.addItem(R.string.zen_mode_event_rule_reply_any,
- EventInfo.REPLY_ANY);
mReply.addItem(R.string.zen_mode_event_rule_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,
EventInfo.REPLY_YES);
mReply.setCallback(new DropDownPreference.Callback() {
@@ -135,7 +115,6 @@ public class ZenModeEventRuleSettings extends ZenModeRuleSettingsBase {
@Override
protected void updateControlsInternal() {
mCalendar.setSelectedValue(mEvent.calendar);
- mAttendance.setSelectedValue(mEvent.attendance);
mReply.setSelectedValue(mEvent.reply);
}
diff --git a/src/com/android/settings/notification/ZenRuleNameDialog.java b/src/com/android/settings/notification/ZenRuleNameDialog.java
index cd5c766..847007c 100644
--- a/src/com/android/settings/notification/ZenRuleNameDialog.java
+++ b/src/com/android/settings/notification/ZenRuleNameDialog.java
@@ -166,7 +166,6 @@ public abstract class ZenRuleNameDialog {
private static RuleInfo defaultNewEvent() {
final EventInfo event = new EventInfo();
event.calendar = 0; // any
- event.attendance = EventInfo.ATTENDANCE_REQUIRED_OR_OPTIONAL;
event.reply = EventInfo.REPLY_ANY_EXCEPT_NO;
final RuleInfo rt = new RuleInfo();
rt.settingsAction = ZenModeEventRuleSettings.ACTION;