[Output Switcher] Fix recyclerview flickering
Bug: 219067810 Test: Verified on device Change-Id: I7532a54a6b0fa945a4c87a9b8abb39f51d3a9aba
This commit is contained in:
committed by
Shaowei Shen
parent
db5cc5048e
commit
1d25d0b587
@@ -54,6 +54,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
|||||||
MediaOutputDialog mediaOutputDialog) {
|
MediaOutputDialog mediaOutputDialog) {
|
||||||
super(controller);
|
super(controller);
|
||||||
mMediaOutputDialog = mediaOutputDialog;
|
mMediaOutputDialog = mediaOutputDialog;
|
||||||
|
setHasStableIds(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,6 +79,20 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
final int size = mController.getMediaDevices().size();
|
||||||
|
if (position == size && mController.isZeroMode()) {
|
||||||
|
return -1;
|
||||||
|
} else if (position < size) {
|
||||||
|
return ((List<MediaDevice>) (mController.getMediaDevices()))
|
||||||
|
.get(position).getId().hashCode();
|
||||||
|
} else if (DEBUG) {
|
||||||
|
Log.d(TAG, "Incorrect position for item id: " + position);
|
||||||
|
}
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
if (mController.isZeroMode()) {
|
if (mController.isZeroMode()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user