Revert "Tweak Modes layouts and use updated strings to match mocks"
This reverts commit 0359aaeb47e66b1d7eda4e1291aaf7ef5d280627.
Reason for revert: <Potential culprit for b/356564046 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.>
Change-Id: I980838773078d822d20608e5975a26cf8dbed2be
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 28e1f05..311b56f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7955,28 +7955,24 @@
<!-- Zen Modes: Title for the Modes option and associated settings page. [CHAR LIMIT=50]-->
<string name="zen_modes_list_title">Priority Modes</string>
- <!-- Zen Modes: Intro text describing the feature. [CHAR LIMIT=NONE]-->
- <string name="zen_modes_list_intro">Minimize distractions and take control of your attention with modes for sleep, work, driving, and everything in between.</string>
-
<!-- Zen Modes: Caption of the "add a mode" item in the modes list -->
- <string name="zen_modes_add_mode">Create your own mode</string>
+ <string name="zen_modes_add_mode">Add a mode</string>
<!-- Zen Modes: Summary for the Do not Disturb option and associated settings page. [CHAR LIMIT=240]-->
<string name="zen_mode_settings_summary">Only get notified by important people and apps</string>
<!-- Zen Modes: Option to add an automatic schedule for a mode. [CHAR_LIMIT=40] -->
- <string name="zen_mode_select_schedule">Set a schedule</string>
-
- <!-- Priority Modes: Title of the dialog used to choose an automatic schedule for a mode. [CHAR_LIMIT=40] -->
- <string name="zen_mode_select_schedule_title">Schedule based on</string>
+ <string name="zen_mode_select_schedule">Select activation type</string>
<!-- Priority Modes: Option to choose a time-based schedule for a mode. [CHAR_LIMIT=40] -->
- <string name="zen_mode_select_schedule_time">Day and time</string>
+ <string name="zen_mode_select_schedule_time">Time</string>
<!-- Priority Modes: Example text for the option to choose a time-based schedule for a mode. [CHAR_LIMIT=60] -->
- <string name="zen_mode_select_schedule_time_example">\"9 AM - 5 PM weekdays\"</string>
+ <string name="zen_mode_select_schedule_time_example">Ex. \"9:30 – 5:00 PM\"</string>
<!-- Priority Modes: Option to choose a calendar-events-based schedule for a mode. [CHAR_LIMIT=40] -->
- <string name="zen_mode_select_schedule_calendar">Calendar events</string>
+ <string name="zen_mode_select_schedule_calendar">Calendar</string>
+ <!-- Priority Modes: Example text for the option to choose a calendar-events-based schedule for a mode. [CHAR_LIMIT=60] -->
+ <string name="zen_mode_select_schedule_calendar_example">Ex. \"Personal calendar\"</string>
<!-- Priority Modes: Short text that indicates that a mode is currently on (active). [CHAR_LIMIT=10] -->
<string name="zen_mode_active_text">ON</string>
@@ -7996,15 +7992,6 @@
<!-- Priority Modes: Option to add a "custom" mode in the "Add a mode" dialog. [CHAR_LIMIT=20] -->
<string name="zen_mode_new_option_custom">Custom</string>
- <!-- Priority Modes: Caption of the button to turn on a mode [CHAR LIMIT=20] -->
- <string name="zen_mode_action_activate">Turn on now</string>
-
- <!-- Priority Modes: Caption of the button to turn off a currently active mode [CHAR LIMIT=20] -->
- <string name="zen_mode_action_deactivate">Turn off</string>
-
- <!-- Priority Modes: Text to display if a mode isn't found [CHAR LIMIT=40] -->
- <string name="zen_mode_not_found_text">Mode not found</string>
-
<!-- Subtitle for the Do not Disturb slice. [CHAR LIMIT=50]-->
<string name="zen_mode_slice_subtitle">Limit interruptions</string>
@@ -8042,17 +8029,19 @@
<string name="zen_mode_automatic_rule_settings_page_title">Schedule</string>
<!-- Do not disturb: Title for settings section describing when the rule turns on automatically [CHAR LIMIT=30] -->
- <string name="zen_mode_automatic_trigger_title">When to turn on automatically</string>
+ <string name="zen_mode_automatic_trigger_title">Turn on automatically</string>
- <!-- Priority Modes: Title prompting a user to choose a calendar to use for an automatic rule [CHAR LIMIT=30] -->
- <string name="zen_mode_set_calendar_title">Event schedule</string>
- <!-- Priority Modes: Title prompting a user to choose a calendar to use for an automatic rule [CHAR LIMIT=30] -->
- <string name="zen_mode_set_calendar_which_calendar">Turn on during events for</string>
- <!-- Priority Modes: Title prompting a user to choose a calendar to use for an automatic rule [CHAR LIMIT=30] -->
- <string name="zen_mode_set_calendar_which_reply">Where invite reply is</string>
+ <!-- Do not disturb: Title prompting a user to choose a calendar to use for an automatic rule [CHAR LIMIT=30] -->
+ <string name="zen_mode_set_calendar_title">Add a calendar</string>
+
+ <!-- Do not disturb: Link text prompting a user to click through to setting a calendar [CHAR LIMIT=40] -->
+ <string name="zen_mode_set_calendar_link">Use your calendar</string>
+
+ <!-- Do not disturb: Title on the page where users choose a calendar to determine the schedule for an automatically-triggered DND rule. [CHAR LIMIT=30] -->
+ <string name="zen_mode_set_calendar_category_title">Schedule</string>
<!-- Do not disturb: Title prompting a user to set a time-based schedule to use for an automatic rule [CHAR LIMIT=30] -->
- <string name="zen_mode_set_schedule_title">Time schedule</string>
+ <string name="zen_mode_set_schedule_title">Set a schedule</string>
<!-- Do not disturb: Link text prompting a user to click through to setting a time-based schedule [CHAR LIMIT=40] -->
<string name="zen_mode_set_schedule_link">Schedule</string>
@@ -8060,6 +8049,9 @@
<!-- Duration in hours and minutes for the length of a Do Not Disturb schedule. For example "1 hr, 22 min" -->
<string name="zen_mode_schedule_duration"><xliff:g example="10" id="hours">%1$d</xliff:g> hr, <xliff:g example="20" id="minutes">%2$d</xliff:g> min</string>
+ <!-- Priority Modes: Label for switch to enable/disable a rule turning on automatically; links to an app-provided configuration page [CHAR LIMIT=40] -->
+ <string name="zen_mode_configuration_link_title">Turn on automatically</string>
+
<!-- Do not disturb: Title do not disturb settings representing automatic (scheduled) do not disturb rules. [CHAR LIMIT=30] -->
<string name="zen_mode_schedule_category_title">Schedule</string>
@@ -8088,9 +8080,9 @@
<string name="zen_mode_visual_signals_settings_subtitle">Allow visual signals</string>
<!-- Priority Modes: mode page section title [CHAR LIMIT=80] -->
- <string name="mode_interruption_filter_title">Notification filters</string>
+ <string name="mode_interruption_filter_title">Stay focused</string>
<!-- Priority Modes: mode page section title [CHAR LIMIT=80] -->
- <string name="mode_device_effects_title">More settings</string>
+ <string name="mode_device_effects_title">Additional actions</string>
<!-- Summary for the Sound Do not Disturb option when DND isn't currently on. [CHAR LIMIT=NONE]-->
<string name="modes_sound_summary_off">
@@ -8141,7 +8133,7 @@
}
</string>
<!-- Modes: setting for whether the mode should filter (silence/hide) notifications/volume streams -->
- <string name="mode_notification_filter_title">Limit what can notify you</string>
+ <string name="mode_notification_filter_title">Filter interruptions</string>
<!-- Modes: subtext when a mode is not filtering (silence/hide) notifications/volume streams -->
<string name="mode_no_notification_filter">No interruptions are filtered</string>
@@ -9438,7 +9430,7 @@
<string name="zen_mode_rename_title">Edit mode</string>
<!-- Priority Modes: Title for the "add mode" screen [CHAR LIMIT=20] -->
- <string name="zen_mode_new_custom_title">Create a mode</string>
+ <string name="zen_mode_new_custom_title">Add mode</string>
<!-- Priority Modes: Default name for new custom modes [CHAR LIMIT=30] -->
<string name="zen_mode_new_custom_default_name">Custom mode</string>
@@ -9449,26 +9441,26 @@
<!-- Priority Modes: Trigger title for modes of type SCHEDULE_CALENDAR. [CHAR LIMIT=30] -->
<string name="zen_mode_trigger_title_schedule_calendar">Calendar events</string>
<!-- Priority Modes: Trigger title for modes of type BEDTIME. [CHAR LIMIT=30] -->
- <string name="zen_mode_trigger_title_bedtime">Bedtime routine</string>
+ <string name="zen_mode_trigger_title_bedtime">Sleep schedule</string>
<!-- Priority Modes: Trigger title for modes of type DRIVING. [CHAR LIMIT=30] -->
<string name="zen_mode_trigger_title_driving">While driving</string>
<!-- Priority Modes: Generic trigger title for modes of other types [CHAR LIMIT=30] -->
- <string name="zen_mode_trigger_title_generic">App settings</string>
+ <string name="zen_mode_trigger_title_generic">Linked to app</string>
<!-- Priority Modes: Generic trigger summary for modes where the owner app did not provide a triggerDescription but did provide a configurationActivity to call [CHAR LIMIT=60] -->
<string name="zen_mode_trigger_summary_settings_in_app">Info and settings in <xliff:g id="app_name" example="The Awesome App">%1$s</xliff:g></string>
<!-- Priority Modes: Generic trigger summary for modes where the owner app did not provide neither a triggerDescription nor a configurationActivity to call [CHAR LIMIT=60] -->
<string name="zen_mode_trigger_summary_managed_by_app">Managed by <xliff:g id="app_name" example="The Awesome App">%1$s</xliff:g></string>
- <!-- Priority Modes: Title of the confirmation dialog for disabling an enabled mode [CHAR LIMIT=20] -->
- <string name="zen_mode_confirm_disable_mode_title">Disable <xliff:g id="mode_name" example="Driving Mode">%1$s</xliff:g>?</string>
+ <!-- Priority Modes: Title of the confirmation dialog for disabling an enabled mode [CHAR LIMIT=30] -->
+ <string name="zen_mode_confirm_disable_title">Disable Mode</string>
<!-- Priority Modes: Message body of the confirmation dialog for disabling an enabled mode [CHAR LIMIT=NONE] -->
- <string name="zen_mode_confirm_disable_message">This mode will never turn on when disabled</string>
+ <string name="zen_mode_confirm_disable_message">If you disable this feature, the mode will no longer work as intended and its settings will be hidden.</string>
<!-- Priority Modes: Button to disable a mode [CHAR LIMIT=20] -->
<string name="zen_mode_action_disable">Disable</string>
- <!-- Priority Modes: Title of the confirmation dialog for enabling a disabled mode [CHAR LIMIT=20] -->
- <string name="zen_mode_confirm_enable_mode_title">Enable <xliff:g id="mode_name" example="Driving Mode">%1$s</xliff:g>?</string>
+ <!-- Priority Modes: Title of the confirmation dialog for enabling a disabled mode [CHAR LIMIT=30] -->
+ <string name="zen_mode_confirm_enable_title">Enable Mode</string>
<!-- Priority Modes: Message body of the confirmation dialog for enabling a disabled mode [CHAR LIMIT=NONE] -->
- <string name="zen_mode_confirm_enable_message">This mode may turn on automatically based on its settings</string>
+ <string name="zen_mode_confirm_enable_message">If you enable this feature, the mode will activate automatically according to its schedule.</string>
<!-- Priority Modes: Button to disable a mode [CHAR LIMIT=20] -->
<string name="zen_mode_action_enable">Enable</string>
diff --git a/res/xml/modes_calls_settings.xml b/res/xml/modes_calls_settings.xml
index b564020..f2ba7f1 100644
--- a/res/xml/modes_calls_settings.xml
+++ b/res/xml/modes_calls_settings.xml
@@ -24,21 +24,14 @@
<PreferenceCategory
android:key="zen_mode_settings_category_calls"
- android:title="@string/zen_mode_calls_header">
+ android:title="@string/zen_mode_calls_header"
+ settings:allowDividerBelow="true">
</PreferenceCategory>
- <com.android.settings.applications.SpacePreference
- android:key="hearing_aid_space_layout"
- android:layout_height="16dp"/>
-
<!-- Repeat callers -->
<SwitchPreferenceCompat
android:key="zen_mode_repeat_callers"
- android:title="@string/zen_mode_repeat_callers_title" />
+ android:title="@string/zen_mode_repeat_callers_title"
+ settings:allowDividerAbove="true"/>
- <com.android.settingslib.widget.FooterPreference
- android:key="info_footer"
- android:title="@string/zen_mode_calls_footer"
- android:selectable="false"
- settings:searchable="false"/>
</PreferenceScreen>
diff --git a/res/xml/modes_list_settings.xml b/res/xml/modes_list_settings.xml
index 5c67218..8207af0 100644
--- a/res/xml/modes_list_settings.xml
+++ b/res/xml/modes_list_settings.xml
@@ -20,12 +20,11 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/zen_modes_list_title">
- <com.android.settingslib.widget.TopIntroPreference
- android:title="@string/zen_modes_list_intro" />
+ <!-- TODO: b/333682392 - add strings for summary as appropriate -->
<PreferenceCategory
android:key="zen_modes_list">
- <!-- Preferences leading to individual mode pages are added in this PreferenceCategory. -->
+ <!-- Preferences leading to rules are added in this PreferenceCategory. -->
</PreferenceCategory>
<Preference
diff --git a/res/xml/modes_messages_settings.xml b/res/xml/modes_messages_settings.xml
index b87de0b..d4aee3d 100644
--- a/res/xml/modes_messages_settings.xml
+++ b/res/xml/modes_messages_settings.xml
@@ -26,10 +26,4 @@
android:key="zen_mode_settings_category_messages"
android:title="@string/zen_mode_messages_header">
</PreferenceCategory>
-
- <com.android.settingslib.widget.FooterPreference
- android:key="info_footer"
- android:title="@string/zen_mode_messages_footer"
- android:selectable="false"
- settings:searchable="false"/>
</PreferenceScreen>
diff --git a/res/xml/modes_people_settings.xml b/res/xml/modes_people_settings.xml
index af292ad..d58b2d7 100644
--- a/res/xml/modes_people_settings.xml
+++ b/res/xml/modes_people_settings.xml
@@ -17,7 +17,6 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/zen_category_people" >
<!-- Calls & Messages -->
@@ -35,10 +34,4 @@
android:title="@string/zen_mode_calls_title"
android:icon="@drawable/ic_zen_mode_people_calls" />
</PreferenceCategory>
-
- <com.android.settingslib.widget.FooterPreference
- android:key="info_footer"
- android:title="@string/zen_mode_people_footer"
- android:selectable="false"
- settings:searchable="false"/>
</PreferenceScreen>
diff --git a/res/xml/modes_set_calendar.xml b/res/xml/modes_set_calendar.xml
index be094f2..02eb26e 100644
--- a/res/xml/modes_set_calendar.xml
+++ b/res/xml/modes_set_calendar.xml
@@ -23,18 +23,20 @@
android:title="@string/zen_mode_set_calendar_title">
<PreferenceCategory
- android:key="zen_mode_event_category">
+ android:key="zen_mode_event_category"
+ android:title="@string/zen_mode_set_calendar_category_title">
+ <!-- TODO: b/333682392 - use correct strings for below two prefs -->
<!-- During events for -->
<DropDownPreference
android:key="calendar"
- android:title="@string/zen_mode_set_calendar_which_calendar"
+ android:title="@string/zen_mode_event_rule_calendar"
android:summary="%s" />
<!-- Where reply is -->
<DropDownPreference
android:key="reply"
- android:title="@string/zen_mode_set_calendar_which_reply"
+ android:title="@string/zen_mode_event_rule_reply"
android:summary="%s" />
</PreferenceCategory>
diff --git a/src/com/android/settings/notification/modes/ZenModeButtonPreferenceController.java b/src/com/android/settings/notification/modes/ZenModeButtonPreferenceController.java
index bb9d23c..998b596 100644
--- a/src/com/android/settings/notification/modes/ZenModeButtonPreferenceController.java
+++ b/src/com/android/settings/notification/modes/ZenModeButtonPreferenceController.java
@@ -84,9 +84,9 @@
}
});
if (zenMode.isActive()) {
- mZenButton.setText(R.string.zen_mode_action_deactivate);
+ mZenButton.setText(R.string.zen_mode_button_turn_off);
} else {
- mZenButton.setText(R.string.zen_mode_action_activate);
+ mZenButton.setText(R.string.zen_mode_button_turn_on);
}
}
}
diff --git a/src/com/android/settings/notification/modes/ZenModeFragmentBase.java b/src/com/android/settings/notification/modes/ZenModeFragmentBase.java
index ed3a71c..c63b3a8 100644
--- a/src/com/android/settings/notification/modes/ZenModeFragmentBase.java
+++ b/src/com/android/settings/notification/modes/ZenModeFragmentBase.java
@@ -131,7 +131,7 @@
}
private void toastAndFinish() {
- Toast.makeText(mContext, R.string.zen_mode_not_found_text, Toast.LENGTH_SHORT)
+ Toast.makeText(mContext, R.string.zen_mode_rule_not_found_text, Toast.LENGTH_SHORT)
.show();
this.finish();
}
diff --git a/src/com/android/settings/notification/modes/ZenModeScheduleChooserDialog.java b/src/com/android/settings/notification/modes/ZenModeScheduleChooserDialog.java
index 6202648..14264b7 100644
--- a/src/com/android/settings/notification/modes/ZenModeScheduleChooserDialog.java
+++ b/src/com/android/settings/notification/modes/ZenModeScheduleChooserDialog.java
@@ -50,16 +50,15 @@
static final int OPTION_TIME = 0;
static final int OPTION_CALENDAR = 1;
- private record ScheduleOption(@StringRes int nameResId,
- @Nullable @StringRes Integer exampleResId,
- @DrawableRes int iconResId) { }
+ private record ScheduleOption(@StringRes int nameResId, @StringRes int exampleResId,
+ @DrawableRes int iconResId) {}
private static final ImmutableList<ScheduleOption> SCHEDULE_OPTIONS = ImmutableList.of(
new ScheduleOption(R.string.zen_mode_select_schedule_time,
R.string.zen_mode_select_schedule_time_example,
com.android.internal.R.drawable.ic_zen_mode_type_schedule_time),
new ScheduleOption(R.string.zen_mode_select_schedule_calendar,
- null,
+ R.string.zen_mode_select_schedule_calendar_example,
com.android.internal.R.drawable.ic_zen_mode_type_schedule_calendar));
private OnScheduleOptionListener mOptionListener;
@@ -86,7 +85,7 @@
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
checkState(getContext() != null);
return new AlertDialog.Builder(getContext())
- .setTitle(R.string.zen_mode_select_schedule_title)
+ .setTitle(R.string.zen_mode_choose_rule_type)
.setAdapter(new OptionsAdapter(getContext()),
(dialog, which) -> onScheduleTypeSelected(which))
.setNegativeButton(R.string.cancel, null)
@@ -116,12 +115,7 @@
ScheduleOption option = checkNotNull(getItem(position));
imageView.setImageResource(option.iconResId());
title.setText(option.nameResId());
- if (option.exampleResId() != null) {
- subtitle.setVisibility(View.VISIBLE);
- subtitle.setText(option.exampleResId());
- } else {
- subtitle.setVisibility(View.GONE);
- }
+ subtitle.setText(option.exampleResId());
return convertView;
}
diff --git a/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceController.java b/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceController.java
index 885c4db..3ee6d94 100644
--- a/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceController.java
+++ b/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceController.java
@@ -53,8 +53,6 @@
private final ConfigurationActivityHelper mConfigurationActivityHelper;
private final ZenServiceListing mServiceListing;
- private String mModeName;
-
ZenModeTriggerUpdatePreferenceController(Context context, String key,
ZenModesBackend backend) {
this(context, key, backend, context.getPackageManager(),
@@ -84,7 +82,6 @@
return;
}
- mModeName = zenMode.getName();
PrimarySwitchPreference triggerPref = (PrimarySwitchPreference) preference;
triggerPref.setChecked(zenMode.getRule().isEnabled());
triggerPref.setOnPreferenceChangeListener(mSwitchChangeListener);
@@ -192,15 +189,15 @@
};
private void confirmChangeEnabled(Preference preference, boolean enabled) {
- @StringRes int titleFormat = enabled ? R.string.zen_mode_confirm_enable_mode_title
- : R.string.zen_mode_confirm_disable_mode_title;
+ @StringRes int title = enabled ? R.string.zen_mode_confirm_enable_title
+ : R.string.zen_mode_confirm_disable_title;
@StringRes int message = enabled ? R.string.zen_mode_confirm_enable_message
: R.string.zen_mode_confirm_disable_message;
@StringRes int confirmButton = enabled ? R.string.zen_mode_action_enable
: R.string.zen_mode_action_disable;
new AlertDialog.Builder(mContext)
- .setTitle(mContext.getString(titleFormat, mModeName))
+ .setTitle(title)
.setMessage(message)
.setPositiveButton(confirmButton,
(dialog, which) -> setModeEnabled(enabled))
diff --git a/tests/robotests/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceControllerTest.java
index 80d314c..a3fe57e 100644
--- a/tests/robotests/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/modes/ZenModeTriggerUpdatePreferenceControllerTest.java
@@ -47,7 +47,6 @@
import android.platform.test.flag.junit.SetFlagsRule;
import android.service.notification.SystemZenRules;
import android.service.notification.ZenModeConfig;
-import android.widget.TextView;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@@ -175,21 +174,18 @@
@Test
public void onPreferenceChange_toggleOn_enablesModeAfterConfirmation() {
// Start with a disabled mode
- ZenMode zenMode = new TestModeBuilder().setName("The mode").setEnabled(false).build();
+ ZenMode zenMode = new TestModeBuilder().setEnabled(false).build();
mController.updateZenMode(mPreference, zenMode);
// Flip the switch
mPreference.callChangeListener(true);
verify(mBackend, never()).updateMode(any());
- AlertDialog confirmDialog = ShadowAlertDialog.getLatestAlertDialog();
- assertThat(confirmDialog).isNotNull();
- assertThat(confirmDialog.isShowing()).isTrue();
- assertThat(((TextView) confirmDialog.findViewById(com.android.internal.R.id.alertTitle))
- .getText()).isEqualTo("Enable The mode?");
-
// Oh wait, I forgot to confirm! Let's do that
- confirmDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
+ assertThat(ShadowAlertDialog.getLatestAlertDialog()).isNotNull();
+ assertThat(ShadowAlertDialog.getLatestAlertDialog().isShowing()).isTrue();
+ ShadowAlertDialog.getLatestAlertDialog()
+ .getButton(AlertDialog.BUTTON_POSITIVE).performClick();
shadowOf(Looper.getMainLooper()).idle();
// Verify the backend got asked to update the mode to be enabled
@@ -202,21 +198,18 @@
@Test
public void onPreferenceChange_toggleOff_disablesModeAfterConfirmation() {
// Start with an enabled mode
- ZenMode zenMode = new TestModeBuilder().setName("The mode").setEnabled(true).build();
+ ZenMode zenMode = new TestModeBuilder().setEnabled(true).build();
mController.updateZenMode(mPreference, zenMode);
// Flip the switch
mPreference.callChangeListener(false);
verify(mBackend, never()).updateMode(any());
- AlertDialog confirmDialog = ShadowAlertDialog.getLatestAlertDialog();
- assertThat(confirmDialog).isNotNull();
- assertThat(confirmDialog.isShowing()).isTrue();
- assertThat(((TextView) confirmDialog.findViewById(com.android.internal.R.id.alertTitle))
- .getText()).isEqualTo("Disable The mode?");
-
// Oh wait, I forgot to confirm! Let's do that
- confirmDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
+ assertThat(ShadowAlertDialog.getLatestAlertDialog()).isNotNull();
+ assertThat(ShadowAlertDialog.getLatestAlertDialog().isShowing()).isTrue();
+ ShadowAlertDialog.getLatestAlertDialog()
+ .getButton(AlertDialog.BUTTON_POSITIVE).performClick();
shadowOf(Looper.getMainLooper()).idle();
// Verify the backend got asked to update the mode to be disabled
@@ -321,7 +314,7 @@
mController.updateState(mPreference, mode);
assertThat(mPreference.isVisible()).isTrue();
- assertThat(mPreference.getTitle()).isEqualTo("App settings");
+ assertThat(mPreference.getTitle()).isEqualTo("Linked to app");
assertThat(mPreference.getSummary()).isEqualTo("When The Music's Over");
assertThat(mPreference.getIntent()).isEqualTo(configurationIntent);
}
@@ -338,7 +331,7 @@
mController.updateState(mPreference, mode);
assertThat(mPreference.isVisible()).isTrue();
- assertThat(mPreference.getTitle()).isEqualTo("App settings");
+ assertThat(mPreference.getTitle()).isEqualTo("Linked to app");
assertThat(mPreference.getSummary()).isEqualTo("When the saints go marching in");
assertThat(mPreference.getIntent()).isNull();
}
@@ -356,7 +349,7 @@
mController.updateState(mPreference, mode);
assertThat(mPreference.isVisible()).isTrue();
- assertThat(mPreference.getTitle()).isEqualTo("App settings");
+ assertThat(mPreference.getTitle()).isEqualTo("Linked to app");
assertThat(mPreference.getSummary()).isEqualTo("Info and settings in The App Name");
}
@@ -372,7 +365,7 @@
mController.updateState(mPreference, mode);
assertThat(mPreference.isVisible()).isTrue();
- assertThat(mPreference.getTitle()).isEqualTo("App settings");
+ assertThat(mPreference.getTitle()).isEqualTo("Linked to app");
assertThat(mPreference.getSummary()).isEqualTo("Managed by The App Name");
}
}