Set content description for the "settings" of starred contacts, priority conversations, etc
Fixes: 368124250 Test: manual, with Talkback Flag: android.app.modes_ui Change-Id: Ib4e8bdd5ea0931db2049925f82696d3a55f35bcb
This commit is contained in:
@@ -9324,6 +9324,10 @@
|
|||||||
other {# conversations}
|
other {# conversations}
|
||||||
}
|
}
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<!-- Modes: Content description of the "gear" icon that takes the user to the Conversation settings. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="zen_mode_from_conversations_settings">Conversations settings</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=120] Zen mode settings: Header for calls and messages section of conversations
|
<!-- [CHAR LIMIT=120] Zen mode settings: Header for calls and messages section of conversations
|
||||||
setting page -->
|
setting page -->
|
||||||
<string name="zen_mode_people_calls_messages_section_title">Who can interrupt</string>
|
<string name="zen_mode_people_calls_messages_section_title">Who can interrupt</string>
|
||||||
@@ -9392,6 +9396,11 @@
|
|||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Calls or messages option value: From starred contacts only -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Calls or messages option value: From starred contacts only -->
|
||||||
<string name="zen_mode_from_starred">Starred contacts</string>
|
<string name="zen_mode_from_starred">Starred contacts</string>
|
||||||
|
|
||||||
|
<!-- Modes: Content description of the "gear" icon that takes the user to the Contacts app to manage contacts. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="zen_mode_from_contacts_settings">Contacts settings</string>
|
||||||
|
<!-- Modes: Content description of the "gear" icon that takes the user to the Contacts app to manage starred contacts. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="zen_mode_from_starred_settings">Starred contacts settings</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Calls option value: No calls allowed -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Calls option value: No calls allowed -->
|
||||||
<string name="zen_mode_none_calls">None</string>
|
<string name="zen_mode_none_calls">None</string>
|
||||||
<!-- [CHAR LIMIT=40] Zen mode settings: Messages option value: No messages allowed -->
|
<!-- [CHAR LIMIT=40] Zen mode settings: Messages option value: No messages allowed -->
|
||||||
@@ -9464,6 +9473,8 @@
|
|||||||
<string name="zen_mode_apps_work_app"><xliff:g id="app_label" example="Chrome">%s</xliff:g> (Work)</string>
|
<string name="zen_mode_apps_work_app"><xliff:g id="app_label" example="Chrome">%s</xliff:g> (Work)</string>
|
||||||
<!-- Text displayed (for a brief time) while the list of bypassing apps is being fetched. Will be replaced by a zen_mode_apps_subtext. [CHAR_LIMIT=60] -->
|
<!-- Text displayed (for a brief time) while the list of bypassing apps is being fetched. Will be replaced by a zen_mode_apps_subtext. [CHAR_LIMIT=60] -->
|
||||||
<string name="zen_mode_apps_calculating">Calculating\u2026</string>
|
<string name="zen_mode_apps_calculating">Calculating\u2026</string>
|
||||||
|
<!-- Modes: Content description of the "gear" icon that takes the user to the "Apps that can interrupt" settings. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="zen_mode_apps_priority_apps_settings">Apps settings</string>
|
||||||
<!-- Modes: Format for a string displayed when there are more items (e.g. apps, contacts) that can be shown. For example, we show (A)(B)(C)(+5), where this string represents the "+5" value. Needs to be as compact as possible, since it will be drawn in a really small area. [CHAR_LIMIT=4] -->
|
<!-- Modes: Format for a string displayed when there are more items (e.g. apps, contacts) that can be shown. For example, we show (A)(B)(C)(+5), where this string represents the "+5" value. Needs to be as compact as possible, since it will be drawn in a really small area. [CHAR_LIMIT=4] -->
|
||||||
<string name="zen_mode_plus_n_items">+<xliff:g id="number" example="42">%d</xliff:g></string>
|
<string name="zen_mode_plus_n_items">+<xliff:g id="number" example="42">%d</xliff:g></string>
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.TwoStatePreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settingslib.notification.modes.ZenMode;
|
import com.android.settingslib.notification.modes.ZenMode;
|
||||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||||
@@ -58,6 +59,8 @@ public class ZenModeAppsPreferenceController extends
|
|||||||
pref.setExtraWidgetOnClickListener(p -> {
|
pref.setExtraWidgetOnClickListener(p -> {
|
||||||
launchPrioritySettings();
|
launchPrioritySettings();
|
||||||
});
|
});
|
||||||
|
pref.setExtraWidgetContentDescription(
|
||||||
|
mContext.getString(R.string.zen_mode_apps_priority_apps_settings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
|
@@ -38,6 +38,8 @@ import android.service.notification.ZenPolicy;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
@@ -118,25 +120,27 @@ class ZenModePrioritySendersPreferenceController
|
|||||||
public void displayPreference(PreferenceScreen screen) {
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
mPreferenceCategory = checkNotNull(screen.findPreference(getPreferenceKey()));
|
mPreferenceCategory = checkNotNull(screen.findPreference(getPreferenceKey()));
|
||||||
if (mPreferenceCategory.getPreferenceCount() == 0) {
|
if (mPreferenceCategory.getPreferenceCount() == 0) {
|
||||||
makeSelectorPreference(KEY_STARRED,
|
makeSelectorPreference(KEY_STARRED, R.string.zen_mode_from_starred,
|
||||||
com.android.settings.R.string.zen_mode_from_starred, mIsMessages, true);
|
R.string.zen_mode_from_starred_settings, mIsMessages, true);
|
||||||
makeSelectorPreference(KEY_CONTACTS,
|
makeSelectorPreference(KEY_CONTACTS, R.string.zen_mode_from_contacts,
|
||||||
com.android.settings.R.string.zen_mode_from_contacts, mIsMessages, true);
|
R.string.zen_mode_from_contacts_settings, mIsMessages, true);
|
||||||
if (mIsMessages) {
|
if (mIsMessages) {
|
||||||
// "Any conversations" will only be available as option if it is the current value.
|
// "Any conversations" will only be available as option if it is the current value.
|
||||||
// Because it's confusing and we don't want users setting it up that way, but apps
|
// Because it's confusing and we don't want users setting it up that way, but apps
|
||||||
// could create such ZenPolicies and we must show that.
|
// could create such ZenPolicies and we must show that.
|
||||||
makeSelectorPreference(KEY_ANY_CONVERSATIONS,
|
makeSelectorPreference(KEY_ANY_CONVERSATIONS,
|
||||||
com.android.settings.R.string.zen_mode_from_all_conversations, true,
|
R.string.zen_mode_from_all_conversations,
|
||||||
|
R.string.zen_mode_from_conversations_settings, true,
|
||||||
/* isVisibleByDefault= */ false);
|
/* isVisibleByDefault= */ false);
|
||||||
makeSelectorPreference(KEY_IMPORTANT_CONVERSATIONS,
|
makeSelectorPreference(KEY_IMPORTANT_CONVERSATIONS,
|
||||||
com.android.settings.R.string.zen_mode_from_important_conversations, true,
|
R.string.zen_mode_from_important_conversations,
|
||||||
|
R.string.zen_mode_from_conversations_settings, true,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
makeSelectorPreference(KEY_ANY,
|
makeSelectorPreference(KEY_ANY,
|
||||||
com.android.settings.R.string.zen_mode_from_anyone, mIsMessages, true);
|
R.string.zen_mode_from_anyone, null, mIsMessages, true);
|
||||||
makeSelectorPreference(KEY_NONE,
|
makeSelectorPreference(KEY_NONE,
|
||||||
com.android.settings.R.string.zen_mode_none_messages, mIsMessages, true);
|
R.string.zen_mode_none_messages, null, mIsMessages, true);
|
||||||
}
|
}
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
}
|
}
|
||||||
@@ -229,8 +233,9 @@ class ZenModePrioritySendersPreferenceController
|
|||||||
return CONVERSATION_SENDERS_UNSET;
|
return CONVERSATION_SENDERS_UNSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSelectorPreference(String key, int titleId,
|
private void makeSelectorPreference(String key, @StringRes int titleId,
|
||||||
boolean isCheckbox, boolean isVisibleByDefault) {
|
@Nullable @StringRes Integer settingsContentDescriptionResId, boolean isCheckbox,
|
||||||
|
boolean isVisibleByDefault) {
|
||||||
final SelectorWithWidgetPreference pref =
|
final SelectorWithWidgetPreference pref =
|
||||||
new SelectorWithWidgetPreference(mPreferenceCategory.getContext(), isCheckbox);
|
new SelectorWithWidgetPreference(mPreferenceCategory.getContext(), isCheckbox);
|
||||||
pref.setKey(key);
|
pref.setKey(key);
|
||||||
@@ -241,6 +246,9 @@ class ZenModePrioritySendersPreferenceController
|
|||||||
View.OnClickListener widgetClickListener = getWidgetClickListener(key);
|
View.OnClickListener widgetClickListener = getWidgetClickListener(key);
|
||||||
if (widgetClickListener != null) {
|
if (widgetClickListener != null) {
|
||||||
pref.setExtraWidgetOnClickListener(widgetClickListener);
|
pref.setExtraWidgetOnClickListener(widgetClickListener);
|
||||||
|
pref.setExtraWidgetContentDescription(settingsContentDescriptionResId != null
|
||||||
|
? mContext.getString(settingsContentDescriptionResId)
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPreferenceCategory.addPreference(pref);
|
mPreferenceCategory.addPreference(pref);
|
||||||
|
Reference in New Issue
Block a user