[Output Switcher] Fix recyclerview flickering
Bug: 219067810
Test: Verified on device
Change-Id: I7532a54a6b0fa945a4c87a9b8abb39f51d3a9aba
(cherry picked from commit 1d25d0b587)
Merged-In: I7532a54a6b0fa945a4c87a9b8abb39f51d3a9aba
This commit is contained in:
committed by
Shaowei Shen
parent
9e16ca47b8
commit
fcf85a36c0
@@ -54,6 +54,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
MediaOutputDialog mediaOutputDialog) {
|
||||
super(controller);
|
||||
mMediaOutputDialog = mediaOutputDialog;
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
||||
@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
|
||||
public int getItemCount() {
|
||||
if (mController.isZeroMode()) {
|
||||
|
||||
Reference in New Issue
Block a user