[Sound Panel] Fix bugs for sound panel slice
1. notify item change when slice live data has update 2. keep showing Output Switcher slice when media state is in "Pause" state Bug: 247043239 Bug: 238715094 Bug: 204165377 Test: verified on device Change-Id: Ic56a70f2f2835231519e2fccf0d2e649d41b106e
This commit is contained in:
committed by
Shaowei Shen
parent
062b18c736
commit
66098febbc
@@ -84,7 +84,7 @@ public class PanelSlicesAdapter
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SliceRowViewHolder sliceRowViewHolder, int position) {
|
||||
sliceRowViewHolder.onBind(mSliceLiveData.get(position), position);
|
||||
sliceRowViewHolder.onBind(mSliceLiveData.get(position).getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,15 +132,14 @@ public class PanelSlicesAdapter
|
||||
/**
|
||||
* Called when the view is displayed.
|
||||
*/
|
||||
public void onBind(LiveData<Slice> sliceLiveData, int position) {
|
||||
sliceLiveData.observe(mPanelFragment.getViewLifecycleOwner(), sliceView);
|
||||
|
||||
// Do not show the divider above media devices switcher slice per request
|
||||
final Slice slice = sliceLiveData.getValue();
|
||||
|
||||
public void onBind(Slice slice) {
|
||||
// Hides slice which reports with error hint or not contain any slice sub-item.
|
||||
if (slice == null || !isValidSlice(slice)) {
|
||||
sliceView.setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
sliceView.setSlice(slice);
|
||||
sliceView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// Add divider for the end icon
|
||||
@@ -154,7 +153,7 @@ public class PanelSlicesAdapter
|
||||
.action(0 /* attribution */,
|
||||
SettingsEnums.ACTION_PANEL_INTERACTION,
|
||||
mMetricsCategory,
|
||||
sliceLiveData.getValue().getUri().getLastPathSegment()
|
||||
slice.getUri().getLastPathSegment()
|
||||
/* log key */,
|
||||
eventInfo.actionType /* value */);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user