Wifi slice improvement

- always show toggle

Bug: 149666241
Test: robotest
Change-Id: I602d26abf2dfa631a939ee79e9adc63bed44ade0
This commit is contained in:
Jason Chiu
2020-02-20 17:38:01 +08:00
parent e6704dc37d
commit dd1fbd68d0
3 changed files with 22 additions and 62 deletions

View File

@@ -107,7 +107,7 @@ public class WifiSlice implements CustomSliceable {
final boolean isFirstApActive = apCount > 0 && apList.get(0).isActive();
handleNetworkCallback(worker, isFirstApActive);
if (!isToggleNeeded()) {
if (isApRowCollapsed()) {
if (isFirstApActive) {
// refresh header subtext
listBuilder = getListBuilder(true /* isWifiEnabled */, apList.get(0));
@@ -142,8 +142,8 @@ public class WifiSlice implements CustomSliceable {
}
}
protected boolean isToggleNeeded() {
return true;
protected boolean isApRowCollapsed() {
return false;
}
protected ListBuilder.RowBuilder getHeaderRow(AccessPoint accessPoint) {
@@ -160,15 +160,14 @@ public class WifiSlice implements CustomSliceable {
}
private ListBuilder getListBuilder(boolean isWifiEnabled, AccessPoint accessPoint) {
final PendingIntent toggleAction = getBroadcastIntent(mContext);
final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction,
null /* actionTitle */, isWifiEnabled);
final ListBuilder builder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
.setAccentColor(COLOR_NOT_TINTED)
.setKeywords(getKeywords())
.addRow(getHeaderRow(accessPoint));
if (isToggleNeeded()) {
final PendingIntent toggleAction = getBroadcastIntent(mContext);
builder.addAction(SliceAction.createToggle(toggleAction, null /* actionTitle */,
isWifiEnabled));
}
.addRow(getHeaderRow(accessPoint))
.addAction(toggleSliceAction);
return builder;
}