Merge "eOutput Switcher] Fix Dialog refreshing shortage" into tm-qpr-dev
This commit is contained in:
@@ -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