Zen priority settings update
Reordering & adding summary Change-Id: Icc3388410bdea9960c1e2c8609b7c3a979dc99d7 Fixes: 63712680 Test: RunSettingsRoboTests
This commit is contained in:
@@ -358,10 +358,10 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
||||
|
||||
String getPrioritySettingSummary(Policy policy) {
|
||||
String s = mContext.getString(R.string.zen_mode_alarms);
|
||||
s = append(s, isCategoryEnabled(policy, Policy.PRIORITY_CATEGORY_REMINDERS),
|
||||
s = prepend(s, isCategoryEnabled(policy, Policy.PRIORITY_CATEGORY_EVENTS),
|
||||
R.string.zen_mode_events);
|
||||
s = prepend(s, isCategoryEnabled(policy, Policy.PRIORITY_CATEGORY_REMINDERS),
|
||||
R.string.zen_mode_reminders);
|
||||
s = append(s, isCategoryEnabled(policy, Policy.PRIORITY_CATEGORY_EVENTS),
|
||||
R.string.zen_mode_events);
|
||||
if (isCategoryEnabled(policy, Policy.PRIORITY_CATEGORY_MESSAGES)) {
|
||||
if (policy.priorityMessageSenders == Policy.PRIORITY_SENDERS_ANY) {
|
||||
s = append(s, true, R.string.zen_mode_all_messages);
|
||||
@@ -426,6 +426,15 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
||||
return s;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
String prepend(String s, boolean condition, int resId) {
|
||||
if (condition) {
|
||||
return mContext.getString(
|
||||
R.string.join_many_items_middle, mContext.getString(resId), s);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private boolean isCategoryEnabled(Policy policy, int categoryType) {
|
||||
return (policy.priorityCategories & categoryType) != 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user