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

@@ -55,6 +55,7 @@ public class SlicesIndexerTest {
private final boolean PLATFORM_DEFINED = true;
private final boolean IS_DYNAMIC_SUMMARY_ALLOWED = true;
private final int SLICE_TYPE = SliceData.SliceType.SLIDER;
private final String UNAVAILABLE_SLICE_SUBTITLE = "subtitleOfUnavailableSlice";
private Context mContext;
@@ -145,6 +146,9 @@ public class SlicesIndexerTest {
cursor.getColumnIndex(
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE)))
.isEqualTo(1 /* true */);
assertThat(cursor.getString(
cursor.getColumnIndex(IndexColumns.UNAVAILABLE_SLICE_SUBTITLE)))
.isEqualTo(UNAVAILABLE_SLICE_SUBTITLE);
cursor.moveToNext();
}
} finally {
@@ -179,7 +183,8 @@ public class SlicesIndexerTest {
.setPreferenceControllerClassName(PREF_CONTROLLER)
.setPlatformDefined(PLATFORM_DEFINED)
.setSliceType(SLICE_TYPE)
.setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED);
.setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED)
.setUnavailableSliceSubtitle(UNAVAILABLE_SLICE_SUBTITLE);
for (int i = 0; i < KEYS.length; i++) {
builder.setKey(KEYS[i]).setTitle(TITLES[i]);