Adding the ability to customize the subtitle on an unavailable slice

When a slice is depending on some setting and the setting is off,
it shows "depends on another setting".
Add an new attribute for Preference to customize the subtitle when
a slice is unavailable.

Bug: 118399193
Test: Robo test on com.android.settings.slices, com.android.settings.core
Change-Id: I84a8400295b36abb357e5baf98e9be3a8d6ea897
This commit is contained in:
Console Chen
2018-12-19 18:01:09 +08:00
parent e5e94b95dc
commit ce16d7ad63
17 changed files with 256 additions and 31 deletions

View File

@@ -39,6 +39,7 @@ public class SliceDataTest {
private final int SLICE_TYPE = SliceData.SliceType.SWITCH;
private final boolean IS_PLATFORM_DEFINED = true;
private final boolean IS_DYNAMIC_SUMMARY_ALLOWED = true;
private final String UNAVAILABLE_SLICE_SUBTITLE = "subtitleOfUnavailableSlice";
@Test
public void testBuilder_buildsMatchingObject() {
@@ -54,7 +55,8 @@ public class SliceDataTest {
.setPreferenceControllerClassName(PREF_CONTROLLER)
.setSliceType(SLICE_TYPE)
.setPlatformDefined(IS_PLATFORM_DEFINED)
.setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED);
.setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED)
.setUnavailableSliceSubtitle(UNAVAILABLE_SLICE_SUBTITLE);
SliceData data = builder.build();
@@ -70,6 +72,7 @@ public class SliceDataTest {
assertThat(data.getSliceType()).isEqualTo(SLICE_TYPE);
assertThat(data.isPlatformDefined()).isEqualTo(IS_PLATFORM_DEFINED);
assertThat(data.isDynamicSummaryAllowed()).isEqualTo(IS_DYNAMIC_SUMMARY_ALLOWED);
assertThat(data.getUnavailableSliceSubtitle()).isEqualTo(UNAVAILABLE_SLICE_SUBTITLE);
}
@Test(expected = SliceData.InvalidSliceDataException.class)