summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/notification
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-01-04 15:24:03 +0100
committerDanny Baumann <dannybaumann@web.de>2016-01-06 08:47:49 +0100
commitaa9a06e5215e26fa47de01edee4711aae9bbc0fc (patch)
tree2b3f9ed40d24e7baba64feb5b65bb00b8662fc9e /src/com/android/settings/notification
parent257ea74efb23be646c26a3987aecfe472ae1cd90 (diff)
downloadpackages_apps_Settings-aa9a06e5215e26fa47de01edee4711aae9bbc0fc.tar.gz
packages_apps_Settings-aa9a06e5215e26fa47de01edee4711aae9bbc0fc.tar.bz2
packages_apps_Settings-aa9a06e5215e26fa47de01edee4711aae9bbc0fc.zip
Fix zen mode allowed event preference summary.
Simply using lower-cased versions of other strings might work for English, but not for most other languages. Also improve formatting of list: Instead of showing 'a, b, c', show 'a, b and c'. Change-Id: I7a809e0655cbde3af1695ec3ddf86ec818fb191d
Diffstat (limited to 'src/com/android/settings/notification')
-rw-r--r--src/com/android/settings/notification/ZenModeSettings.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index f76ee385d..22c4112fa 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -25,6 +25,7 @@ import android.util.SparseArray;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
+import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
@@ -77,21 +78,21 @@ public class ZenModeSettings extends ZenModeSettingsBase implements Indexable {
}
private void updatePrioritySettingsSummary() {
- final boolean callers = mConfig.allowCalls || mConfig.allowRepeatCallers;
- String s = getResources().getString(R.string.zen_mode_alarms);
- s = appendLowercase(s, mConfig.allowReminders, R.string.zen_mode_reminders);
- s = appendLowercase(s, mConfig.allowEvents, R.string.zen_mode_events);
- s = appendLowercase(s, callers, R.string.zen_mode_selected_callers);
- s = appendLowercase(s, mConfig.allowMessages, R.string.zen_mode_selected_messages);
- mPrioritySettings.setSummary(s);
- }
-
- private String appendLowercase(String s, boolean condition, int resId) {
- if (condition) {
- return getResources().getString(R.string.join_many_items_middle, s,
- getResources().getString(resId).toLowerCase());
+ final ArrayList<String> items = new ArrayList<>();
+ items.add(getString(R.string.zen_mode_alarms));
+ if (mConfig.allowReminders) {
+ items.add(getString(R.string.zen_mode_summary_reminders));
+ }
+ if (mConfig.allowEvents) {
+ items.add(getString(R.string.zen_mode_summary_events));
+ }
+ if (mConfig.allowCalls || mConfig.allowRepeatCallers) {
+ items.add(getString(R.string.zen_mode_summary_selected_callers));
+ }
+ if (mConfig.allowMessages) {
+ items.add(getString(R.string.zen_mode_summary_selected_messages));
}
- return s;
+ mPrioritySettings.setSummary(Utils.join(getResources(), items));
}
private static SparseArray<String> allKeyTitles(Context context) {