Update text on notification on/off toggles for clarity

Test: manual
Fixes: 141011559
Change-Id: I06b8519bb5a80496d84889f8c5264bff098ebefd
This commit is contained in:
Julia Reynolds
2019-11-11 10:23:04 -05:00
parent bfe25c3b29
commit 78b4505d6e
3 changed files with 19 additions and 7 deletions

View File

@@ -62,8 +62,8 @@ public class BlockPreferenceController extends NotificationPreferenceController
pref.setSelectable(false);
SwitchBar bar = pref.findViewById(R.id.switch_bar);
if (bar != null) {
bar.setSwitchBarText(R.string.notification_switch_label,
R.string.notification_switch_label);
String switchBarText = getSwitchBarText();
bar.setSwitchBarText(switchBarText, switchBarText);
bar.show();
try {
bar.addOnSwitchChangeListener(this);
@@ -125,4 +125,18 @@ public class BlockPreferenceController extends NotificationPreferenceController
}
mImportanceListener.onImportanceChanged();
}
String getSwitchBarText() {
if (mChannel != null) {
return mContext.getString(R.string.notification_content_block_title);
} else {
CharSequence fieldContextName;
if (mChannelGroup != null) {
fieldContextName = mChannelGroup.getName();
} else {
fieldContextName = mAppRow.label;
}
return mContext.getString(R.string.notification_switch_label, fieldContextName);
}
}
}

View File

@@ -156,7 +156,8 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
NotificationChannelGroup group) {
RestrictedSwitchPreference preference =
new RestrictedSwitchPreference(mContext);
preference.setTitle(R.string.notification_switch_label);
preference.setTitle(mContext.getString(
R.string.notification_switch_label, group.getName()));
preference.setEnabled(mAdmin == null
&& isChannelGroupBlockable(group));
preference.setChecked(!group.isBlocked());