eOutput Switcher] Fix Dialog refreshing shortage
set freshing flag back to flase if isDragging, which means we won't call notifychange for list, and allow accepting next update. Test: atest MediaOutputBaseDialogTest Bug: 237998088 Change-Id: I8ef482ac5316d33ac03ed8060f7e08847960c5ea
This commit is contained in:
committed by
Shaowei Shen
parent
7b43124412
commit
f770f11d54
@@ -356,15 +356,6 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
|
||||
mHeaderSubtitle.setText(subTitle);
|
||||
mHeaderTitle.setGravity(Gravity.NO_GRAVITY);
|
||||
}
|
||||
if (!mAdapter.isDragging()) {
|
||||
int currentActivePosition = mAdapter.getCurrentActivePosition();
|
||||
if (!colorSetUpdated && !deviceSetChanged && currentActivePosition >= 0
|
||||
&& currentActivePosition < mAdapter.getItemCount()) {
|
||||
mAdapter.notifyItemChanged(currentActivePosition);
|
||||
} else {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
// Show when remote media session is available or
|
||||
// when the device supports BT LE audio + media is playing
|
||||
mStopButton.setVisibility(getStopButtonVisibility());
|
||||
@@ -374,6 +365,18 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
|
||||
|
||||
mBroadcastIcon.setVisibility(getBroadcastIconVisibility());
|
||||
mBroadcastIcon.setOnClickListener(v -> onBroadcastIconClick());
|
||||
if (!mAdapter.isDragging()) {
|
||||
int currentActivePosition = mAdapter.getCurrentActivePosition();
|
||||
if (!colorSetUpdated && !deviceSetChanged && currentActivePosition >= 0
|
||||
&& currentActivePosition < mAdapter.getItemCount()) {
|
||||
mAdapter.notifyItemChanged(currentActivePosition);
|
||||
} else {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
mMediaOutputController.setRefreshing(false);
|
||||
mMediaOutputController.refreshDataSetIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateButtonBackgroundColorFilter() {
|
||||
|
||||
@@ -223,6 +223,14 @@ public class MediaOutputBaseDialogTest extends SysuiTestCase {
|
||||
verify(mMediaOutputBaseAdapter, never()).notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void refresh_inDragging_directSetRefreshingToFalse() {
|
||||
when(mMediaOutputBaseAdapter.isDragging()).thenReturn(true);
|
||||
mMediaOutputBaseDialogImpl.refresh();
|
||||
|
||||
assertThat(mMediaOutputController.isRefreshing()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void refresh_notInDragging_verifyUpdateAdapter() {
|
||||
when(mMediaOutputBaseAdapter.getCurrentActivePosition()).thenReturn(-1);
|
||||
|
||||
Reference in New Issue
Block a user