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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user