[Sound panel] Update Ui layout to match with mertial next
please check bug for before/after screenshot. Bug: 191317779 Test: verified on device Change-Id: Ia570dde71ce9f18376eaba48102cecde6adb85bb
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
|
||||
package com.android.settings.panel;
|
||||
|
||||
import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI;
|
||||
import static android.app.slice.Slice.HINT_ERROR;
|
||||
import static android.app.slice.SliceItem.FORMAT_SLICE;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
@@ -31,6 +32,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.slice.Slice;
|
||||
import androidx.slice.SliceItem;
|
||||
import androidx.slice.widget.SliceView;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -113,8 +115,6 @@ public class PanelSlicesAdapter
|
||||
public class SliceRowViewHolder extends RecyclerView.ViewHolder
|
||||
implements DividerItemDecoration.DividedViewHolder {
|
||||
|
||||
private boolean mDividerAllowedAbove = true;
|
||||
|
||||
@VisibleForTesting
|
||||
final SliceView sliceView;
|
||||
@VisibleForTesting
|
||||
@@ -137,8 +137,10 @@ public class PanelSlicesAdapter
|
||||
|
||||
// Do not show the divider above media devices switcher slice per request
|
||||
final Slice slice = sliceLiveData.getValue();
|
||||
if (slice == null || slice.getUri().equals(MEDIA_OUTPUT_INDICATOR_SLICE_URI)) {
|
||||
mDividerAllowedAbove = false;
|
||||
|
||||
// Hides slice which reports with error hint or not contain any slice sub-item.
|
||||
if (slice == null || !isValidSlice(slice)) {
|
||||
sliceView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Log Panel interaction
|
||||
@@ -156,14 +158,26 @@ public class PanelSlicesAdapter
|
||||
);
|
||||
}
|
||||
|
||||
private boolean isValidSlice(Slice slice) {
|
||||
if (slice.getHints().contains(HINT_ERROR)) {
|
||||
return false;
|
||||
}
|
||||
for (SliceItem item : slice.getItems()) {
|
||||
if (item.getFormat().equals(FORMAT_SLICE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedAbove() {
|
||||
return mDividerAllowedAbove;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDividerAllowedBelow() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user