A new attribute which can show the dynamic summary
For now, slice view shows screen title by default, but it isn't approprate for some simple cases. ie, device model, phone number, android version etc. So, We create a new attribue which let BasePreferenceController be more flxible. User can choose what they want to show in summary text. Fixes: 74900516 Test: make RunSettingsRoboTests Change-Id: I2788c6edfaf8e656170a507607f22513841a3e0a
This commit is contained in:
@@ -74,6 +74,8 @@ public class SliceData {
|
||||
|
||||
private final boolean mIsPlatformDefined;
|
||||
|
||||
private final boolean mIsDynamicSummaryAllowed;
|
||||
|
||||
public String getKey() {
|
||||
return mKey;
|
||||
}
|
||||
@@ -118,6 +120,10 @@ public class SliceData {
|
||||
return mIsPlatformDefined;
|
||||
}
|
||||
|
||||
public boolean isDynamicSummaryAllowed() {
|
||||
return mIsDynamicSummaryAllowed;
|
||||
}
|
||||
|
||||
private SliceData(Builder builder) {
|
||||
mKey = builder.mKey;
|
||||
mTitle = builder.mTitle;
|
||||
@@ -130,6 +136,7 @@ public class SliceData {
|
||||
mPreferenceController = builder.mPrefControllerClassName;
|
||||
mSliceType = builder.mSliceType;
|
||||
mIsPlatformDefined = builder.mIsPlatformDefined;
|
||||
mIsDynamicSummaryAllowed = builder.mIsDynamicSummaryAllowed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,6 +176,8 @@ public class SliceData {
|
||||
|
||||
private boolean mIsPlatformDefined;
|
||||
|
||||
private boolean mIsDynamicSummaryAllowed;
|
||||
|
||||
public Builder setKey(String key) {
|
||||
mKey = key;
|
||||
return this;
|
||||
@@ -224,6 +233,11 @@ public class SliceData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDynamicSummaryAllowed(boolean isDynamicSummaryAllowed) {
|
||||
mIsDynamicSummaryAllowed = isDynamicSummaryAllowed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceData build() {
|
||||
if (TextUtils.isEmpty(mKey)) {
|
||||
throw new InvalidSliceDataException("Key cannot be empty");
|
||||
|
||||
Reference in New Issue
Block a user