Commit 1dbf788a authored by Geoffrey Métais's avatar Geoffrey Métais

Use correct list in video DiffUtil callbacks

(cherry picked from commit e6d7aa75)
parent 2ae98f99
......@@ -388,14 +388,14 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
final MediaWrapper oldItem = getDataset().get(oldItemPosition);
final MediaWrapper oldItem = oldList.get(oldItemPosition);
final MediaWrapper newItem = newList.get(newItemPosition);
return oldItem == newItem || (oldItem.getType() == newItem.getType() && oldItem.equals(newItem));
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
final MediaWrapper oldItem = getDataset().get(oldItemPosition);
final MediaWrapper oldItem = oldList.get(oldItemPosition);
final MediaWrapper newItem = newList.get(newItemPosition);
return oldItem == newItem || (oldItem.getTime() == newItem.getTime()
&& TextUtils.equals(oldItem.getArtworkMrl(), newItem.getArtworkMrl())
......@@ -405,7 +405,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
@Nullable
@Override
public Object getChangePayload(int oldItemPosition, int newItemPosition) {
final MediaWrapper oldItem = getDataset().get(oldItemPosition);
final MediaWrapper oldItem = oldList.get(oldItemPosition);
final MediaWrapper newItem = newList.get(newItemPosition);
if (oldItem.getTime() != newItem.getTime())
return UPDATE_TIME;
......
package org.videolan.vlc.util;
import org.jetbrains.annotations.NotNull;
import org.videolan.medialibrary.media.MediaLibraryItem;
import org.videolan.vlc.gui.DiffUtilAdapter;
import java.util.List;
public class MediaItemDiffCallback< T extends MediaLibraryItem> extends DiffUtilAdapter.DiffCallback<T> {
private static final String TAG = "MediaItemDiffCallback";
@Override
public int getOldListSize() {
return getOldList().size();
return oldList.size();
}
@Override
......@@ -22,7 +19,7 @@ public class MediaItemDiffCallback< T extends MediaLibraryItem> extends DiffUtil
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
final MediaLibraryItem oldItem = getOldList().get(oldItemPosition);
final MediaLibraryItem oldItem = oldList.get(oldItemPosition);
final MediaLibraryItem newItem = newList.get(newItemPosition);
return oldItem == newItem || ((oldItem == null ) == (newItem == null) && oldItem.equals(newItem));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment