Update DND strings and image spacing

Test: manual
Bug: 153428950
Change-Id: I25ff7432d6e22224fd1922f097fdd5bdf9ef9a5a
This commit is contained in:
Beverly
2020-04-07 16:02:34 -04:00
committed by Beverly Tai
parent 23040a3b2b
commit ecc377bab8
13 changed files with 58 additions and 47 deletions

View File

@@ -21,5 +21,7 @@
<ImageView <ImageView
android:id="@+id/zen_mode_settings_senders_image" android:id="@+id/zen_mode_settings_senders_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginTop="@dimen/zen_senders_image_margin_vertical"
android:layout_marginBottom="@dimen/zen_senders_image_margin_vertical"/>
</FrameLayout> </FrameLayout>

View File

@@ -20,6 +20,8 @@
android:id="@+id/zen_mode_settings_senders_overlay_view" android:id="@+id/zen_mode_settings_senders_overlay_view"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_marginTop="@dimen/zen_conversations_image_margin_vertical"
android:layout_marginBottom="@dimen/zen_conversations_image_margin_vertical">
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -19,37 +19,36 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
android:paddingVertical="@dimen/zen_mode_button_padding_vertical">
<TextView <TextView
android:text="@string/zen_mode_settings_summary" android:text="@string/zen_mode_settings_summary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/screen_margin_sides" android:layout_marginStart="@dimen/screen_margin_sides"
android:paddingTop="@dimen/zen_mode_button_padding_vertical" android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"/>
android:paddingBottom="@dimen/zen_mode_button_padding_vertical"/>
<Button <Button
android:id="@+id/zen_mode_settings_turn_on_button" android:id="@+id/zen_mode_settings_turn_on_button"
style="@style/ActionPrimaryButton" style="@style/ActionPrimaryButton"
android:focusableInTouchMode="true"
android:layout_marginStart="@dimen/screen_margin_sides" android:layout_marginStart="@dimen/screen_margin_sides"
android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
android:text="@string/zen_mode_button_turn_on"
android:focusableInTouchMode="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:layout_gravity="left"
android:gravity="center"
android:text="@string/zen_mode_button_turn_on"/>
<Button <Button
android:id="@+id/zen_mode_settings_turn_off_button" android:id="@+id/zen_mode_settings_turn_off_button"
style="@style/ActionSecondaryButton" style="@style/ActionSecondaryButton"
android:focusableInTouchMode="true"
android:layout_marginStart="@dimen/screen_margin_sides" android:layout_marginStart="@dimen/screen_margin_sides"
android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
android:text="@string/zen_mode_button_turn_off"
android:focusableInTouchMode="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:layout_gravity="left"
android:gravity="center"
android:text="@string/zen_mode_button_turn_off" />
</LinearLayout> </LinearLayout>

View File

@@ -88,10 +88,15 @@
<dimen name="notification_history_header_drawable_start">26dp</dimen> <dimen name="notification_history_header_drawable_start">26dp</dimen>
<dimen name="conversation_icon_size">48dp</dimen> <dimen name="conversation_icon_size">48dp</dimen>
<dimen name="zen_mode_button_padding_vertical">16dp</dimen> <dimen name="zen_mode_icon_size">36dp</dimen>
<dimen name="zen_mode_icon_margin">16dp</dimen>
<dimen name="zen_mode_settings_button_margin_vertical">24dp</dimen>
<dimen name="zen_senders_image_margin_vertical">16dp</dimen>
<dimen name="zen_conversations_image_margin_vertical">24dp</dimen>
<dimen name="zen_conversations_icon_offset">32dp</dimen>
<dimen name="zen_conversations_icon_size">50dp</dimen>
<dimen name="zen_schedule_rule_checkbox_padding">7dp</dimen> <dimen name="zen_schedule_rule_checkbox_padding">7dp</dimen>
<dimen name="zen_schedule_day_margin">17dp</dimen> <dimen name="zen_schedule_day_margin">17dp</dimen>
<dimen name="zen_conversations_icon_size">56dp</dimen>
<dimen name="rect_button_radius">8dp</dimen> <dimen name="rect_button_radius">8dp</dimen>

View File

@@ -7958,7 +7958,7 @@
<string name="zen_category_schedule">Schedules</string> <string name="zen_category_schedule">Schedules</string>
<!-- Do not disturb settings, main screen, field, duration setting where user can specify how <!-- Do not disturb settings, main screen, field, duration setting where user can specify how
long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=100] --> long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=100] -->
<string name="zen_category_duration">Set duration for Quick Settings</string> <string name="zen_category_duration">Duration for Quick Settings</string>
<!-- Do not disturb settings, sound and vibrations screen footer [CHAR LIMIT=NONE]--> <!-- Do not disturb settings, sound and vibrations screen footer [CHAR LIMIT=NONE]-->
<string name="zen_sound_footer">When Do Not Disturb is on, sound and vibration will be muted, except for the items you allow above.</string> <string name="zen_sound_footer">When Do Not Disturb is on, sound and vibration will be muted, except for the items you allow above.</string>
@@ -8902,7 +8902,7 @@
<!-- [CHAR LIMIT=120] Zen mode settings: Calls settings header --> <!-- [CHAR LIMIT=120] Zen mode settings: Calls settings header -->
<string name="zen_mode_calls_header">Calls that can interrupt</string> <string name="zen_mode_calls_header">Calls that can interrupt</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Calls screen footer --> <!-- [CHAR LIMIT=NONE] Zen mode settings: Calls screen footer -->
<string name="zen_mode_calls_footer">To be sure allowed calls make sound, check whether your device is set to ring, vibrate, or silent.</string> <string name="zen_mode_calls_footer">To make sure allowed calls make sound, check that device is set to ring</string>
<!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Calls screen footer --> <!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Calls screen footer -->
<string name="zen_mode_custom_calls_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string> <string name="zen_mode_custom_calls_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
@@ -8919,11 +8919,11 @@
<!-- [CHAR LIMIT=40] Zen mode settings: Messages option --> <!-- [CHAR LIMIT=40] Zen mode settings: Messages option -->
<string name="zen_mode_messages_list">messages</string> <string name="zen_mode_messages_list">messages</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title --> <!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title -->
<string name="zen_mode_messages_title">SMS, MMS, and messaging apps</string> <string name="zen_mode_messages_title">Messages</string>
<!-- [CHAR LIMIT=120] Zen mode settings: Messages settings header --> <!-- [CHAR LIMIT=120] Zen mode settings: Messages settings header -->
<string name="zen_mode_messages_header">Messages that can interrupt</string> <string name="zen_mode_messages_header">Messages that can interrupt</string>
<!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]--> <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
<string name="zen_mode_messages_footer">To be sure allowed messages make sound, check whether your device is set to ring, vibrate, or silent.</string> <string name="zen_mode_messages_footer">To make sure allowed messages make sound, check that device is set to ring</string>
<!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Messages screen footer --> <!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Messages screen footer -->
<string name="zen_mode_custom_messages_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string> <string name="zen_mode_custom_messages_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
@@ -8963,14 +8963,14 @@
<!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd --> <!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd -->
<string name="zen_mode_media">Media sounds</string> <string name="zen_mode_media">Media sounds</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Allow media (sound from video) to bypass dnd summary--> <!-- [CHAR LIMIT=NONE] Zen mode settings: Allow media (sound from video) to bypass dnd summary-->
<string name="zen_mode_media_summary">From videos, games, and other media</string> <string name="zen_mode_media_summary">Sounds from videos, games, and other media</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) --> <!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) -->
<string name="zen_mode_media_list">media</string> <string name="zen_mode_media_list">media</string>
<!-- [CHAR LIMIT=80] Zen mode settings: allow touch sounds to bypass DND --> <!-- [CHAR LIMIT=80] Zen mode settings: allow touch sounds to bypass DND -->
<string name="zen_mode_system">Touch sounds</string> <string name="zen_mode_system">Touch sounds</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: allow touch sounds to bypass DND summary --> <!-- [CHAR LIMIT=NONE] Zen mode settings: allow touch sounds to bypass DND summary -->
<string name="zen_mode_system_summary">From your keyboard and other buttons</string> <string name="zen_mode_system_summary">Sounds from the keyboard and other buttons</string>
<!-- [CHAR LIMIT=50] Zen mode settings: System sounds (ie: touch sounds) --> <!-- [CHAR LIMIT=50] Zen mode settings: System sounds (ie: touch sounds) -->
<string name="zen_mode_system_list">touch sounds</string> <string name="zen_mode_system_list">touch sounds</string>
@@ -8982,7 +8982,7 @@
<string name="zen_mode_reminders_list">reminders</string> <string name="zen_mode_reminders_list">reminders</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow event notifications/sounds to bypass DND --> <!-- [CHAR LIMIT=80] Zen mode settings: Allow event notifications/sounds to bypass DND -->
<string name="zen_mode_events">Events</string> <string name="zen_mode_events">Calendar events</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Allow event notifications/sounds to bypass DND summary --> <!-- [CHAR LIMIT=NONE] Zen mode settings: Allow event notifications/sounds to bypass DND summary -->
<string name="zen_mode_events_summary">From upcoming calendar events</string> <string name="zen_mode_events_summary">From upcoming calendar events</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) --> <!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) -->
@@ -9064,7 +9064,7 @@
<!-- [CHAR LIMIT=50] Zen mode settings: calls summary --> <!-- [CHAR LIMIT=50] Zen mode settings: calls summary -->
<string name="zen_mode_calls_summary_two"><xliff:g id="caller type" example="starred contacts">%1$s</xliff:g> and <xliff:g id="caller type" example="repeat callers">%2$s</xliff:g></string> <string name="zen_mode_calls_summary_two"><xliff:g id="caller type" example="starred contacts">%1$s</xliff:g> and <xliff:g id="caller type" example="repeat callers">%2$s</xliff:g></string>
<!-- [CHAR LIMIT=200] Zen mode settings: Repeat callers option summary --> <!-- [CHAR LIMIT=200] Zen mode settings: Repeat callers option summary -->
<string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g> minute period</string> <string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g>-minute period</string>
<!-- [CHAR LIMIT=50] Zen mode settings dnd beahvior description: when a user has chosen custom sounds to bypass DND --> <!-- [CHAR LIMIT=50] Zen mode settings dnd beahvior description: when a user has chosen custom sounds to bypass DND -->
<string name="zen_mode_behavior_summary_custom">Custom</string> <string name="zen_mode_behavior_summary_custom">Custom</string>

View File

@@ -56,7 +56,6 @@
android:key="zen_mode_automation_settings" android:key="zen_mode_automation_settings"
android:title="@string/zen_category_schedule" android:title="@string/zen_category_schedule"
settings:allowDividerAbove="true" settings:allowDividerAbove="true"
settings:allowDividerBelow="true"
android:fragment="com.android.settings.notification.zen.ZenModeAutomationSettings"/> android:fragment="com.android.settings.notification.zen.ZenModeAutomationSettings"/>
<PreferenceCategory <PreferenceCategory

View File

@@ -26,8 +26,7 @@
<!-- Alarms --> <!-- Alarms -->
<SwitchPreference <SwitchPreference
android:key="zen_mode_alarms" android:key="zen_mode_alarms"
android:title="@string/zen_mode_alarms" android:title="@string/zen_mode_alarms"/>
android:summary="@string/zen_mode_alarms_summary"/>
<!-- Media --> <!-- Media -->
<SwitchPreference <SwitchPreference
@@ -44,17 +43,13 @@
<!-- Reminders --> <!-- Reminders -->
<SwitchPreference <SwitchPreference
android:key="zen_mode_reminders" android:key="zen_mode_reminders"
android:title="@string/zen_mode_reminders" android:title="@string/zen_mode_reminders"/>
android:summary="@string/zen_mode_reminders_summary"/>
<!-- Events --> <!-- Events -->
<SwitchPreference <SwitchPreference
android:key="zen_mode_events" android:key="zen_mode_events"
android:title="@string/zen_mode_events" android:title="@string/zen_mode_events"/>
android:summary="@string/zen_mode_events_summary"/>
</PreferenceCategory> </PreferenceCategory>
<com.android.settingslib.widget.FooterPreference/>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -322,7 +322,7 @@ public class ZenModeBackend {
return R.string.zen_mode_from_starred; return R.string.zen_mode_from_starred;
case ZenPolicy.PEOPLE_TYPE_NONE: case ZenPolicy.PEOPLE_TYPE_NONE:
default: default:
return R.string.zen_mode_from_none_calls; return R.string.zen_mode_from_none;
} }
} }
@@ -492,8 +492,12 @@ public class ZenModeBackend {
} }
String getContactsNumberSummary(Context context) { String getContactsNumberSummary(Context context) {
final int numContacts = queryAllContactsData().getCount();
if (numContacts == 0) {
return context.getResources().getString(R.string.zen_mode_from_none);
}
return context.getResources().getString(R.string.zen_mode_contacts_senders_summary, return context.getResources().getString(R.string.zen_mode_contacts_senders_summary,
queryAllContactsData().getCount()); numContacts);
} }
private Cursor queryStarredContactsData() { private Cursor queryStarredContactsData() {

View File

@@ -81,10 +81,10 @@ public class ZenModeButtonPreferenceController extends AbstractZenModePreference
}); });
} }
updateButtons(preference); updatePreference(preference);
} }
private void updateButtons(Preference preference) { private void updatePreference(Preference preference) {
switch (getZenMode()) { switch (getZenMode()) {
case Settings.Global.ZEN_MODE_ALARMS: case Settings.Global.ZEN_MODE_ALARMS:
case Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: case Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:

View File

@@ -25,6 +25,7 @@ import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.service.notification.ConversationChannelWrapper; import android.service.notification.ConversationChannelWrapper;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@@ -60,7 +61,8 @@ public class ZenModeConversationsImagePreferenceController
mNotificationBackend = notificationBackend; mNotificationBackend = notificationBackend;
mIconSizePx = mIconSizePx =
mContext.getResources().getDimensionPixelSize(R.dimen.zen_conversations_icon_size); mContext.getResources().getDimensionPixelSize(R.dimen.zen_conversations_icon_size);
mIconOffsetPx = mIconSizePx * 3 / 4; mIconOffsetPx = mContext.getResources()
.getDimensionPixelSize(R.dimen.zen_conversations_icon_offset);
} }
@Override @Override
@@ -97,6 +99,8 @@ public class ZenModeConversationsImagePreferenceController
R.string.zen_mode_from_important_conversations)); R.string.zen_mode_from_important_conversations));
} else { } else {
mViewGroup.setContentDescription(null); mViewGroup.setContentDescription(null);
mViewGroup.setVisibility(View.GONE);
return;
} }
final int numDrawablesToShow = Math.min(MAX_CONVERSATIONS_SHOWN, final int numDrawablesToShow = Math.min(MAX_CONVERSATIONS_SHOWN,
@@ -111,6 +115,8 @@ public class ZenModeConversationsImagePreferenceController
fl.setPadding((numDrawablesToShow - i - 1) * mIconOffsetPx, 0, 0, 0); fl.setPadding((numDrawablesToShow - i - 1) * mIconOffsetPx, 0, 0, 0);
mViewGroup.addView(fl); mViewGroup.addView(fl);
} }
mViewGroup.setVisibility(numDrawablesToShow > 0 ? View.VISIBLE : View.GONE);
} }
private void loadConversations() { private void loadConversations() {

View File

@@ -171,6 +171,10 @@ public class ZenModePrioritySendersPreferenceController
private RadioButtonPreferenceWithExtraWidget makeRadioPreference(String key, int titleId) { private RadioButtonPreferenceWithExtraWidget makeRadioPreference(String key, int titleId) {
RadioButtonPreferenceWithExtraWidget pref = RadioButtonPreferenceWithExtraWidget pref =
new RadioButtonPreferenceWithExtraWidget(mPreferenceCategory.getContext()); new RadioButtonPreferenceWithExtraWidget(mPreferenceCategory.getContext());
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
View.OnClickListener widgetClickListener = getWidgetClickListener(key); View.OnClickListener widgetClickListener = getWidgetClickListener(key);
if (widgetClickListener != null) { if (widgetClickListener != null) {
pref.setExtraWidgetOnClickListener(widgetClickListener); pref.setExtraWidgetOnClickListener(widgetClickListener);
@@ -179,9 +183,6 @@ public class ZenModePrioritySendersPreferenceController
pref.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE); pref.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
} }
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
mPreferenceCategory.addPreference(pref); mPreferenceCategory.addPreference(pref);
mRadioButtonPreferences.add(pref); mRadioButtonPreferences.add(pref);
return pref; return pref;

View File

@@ -156,7 +156,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|| PRIORITY_CATEGORY_REPEAT_CALLERS == category, true); || PRIORITY_CATEGORY_REPEAT_CALLERS == category, true);
int numCategories = enabledCategories.size(); int numCategories = enabledCategories.size();
if (numCategories == 0) { if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_from_none_calls); return mContext.getString(R.string.zen_mode_from_none);
} else if (numCategories == 1) { } else if (numCategories == 1) {
return mContext.getString(R.string.zen_mode_calls_summary_one, return mContext.getString(R.string.zen_mode_calls_summary_one,
enabledCategories.get(0)); enabledCategories.get(0));
@@ -172,7 +172,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
category -> PRIORITY_CATEGORY_MESSAGES == category, false); category -> PRIORITY_CATEGORY_MESSAGES == category, false);
int numCategories = enabledCategories.size(); int numCategories = enabledCategories.size();
if (numCategories == 0) { if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_from_none_messages); return mContext.getString(R.string.zen_mode_from_none);
} else { } else {
return enabledCategories.get(0); return enabledCategories.get(0);
} }

View File

@@ -49,8 +49,6 @@ public class ZenModeSoundVibrationSettings extends ZenModeSettingsBase implement
controllers.add(new ZenModeSystemPreferenceController(context, lifecycle)); controllers.add(new ZenModeSystemPreferenceController(context, lifecycle));
controllers.add(new ZenModeRemindersPreferenceController(context, lifecycle)); controllers.add(new ZenModeRemindersPreferenceController(context, lifecycle));
controllers.add(new ZenModeEventsPreferenceController(context, lifecycle)); controllers.add(new ZenModeEventsPreferenceController(context, lifecycle));
controllers.add(new ZenModeBehaviorFooterPreferenceController(context, lifecycle,
R.string.zen_sound_footer));
return controllers; return controllers;
} }