[Android] Fix videos duplicated during initial media scan
Geoffrey Métais
git at videolan.org
Thu Jul 27 17:41:24 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jul 27 17:40:40 2017 +0200| [c445aef8ac5760e5c5342340751a5fd801bdfdcd] | committer: Geoffrey Métais
Fix videos duplicated during initial media scan
> https://code.videolan.org/videolan/vlc-android/commit/c445aef8ac5760e5c5342340751a5fd801bdfdcd
---
.../org/videolan/vlc/gui/video/VideoGridFragment.java | 16 ++--------------
.../src/org/videolan/vlc/gui/video/VideoListAdapter.java | 11 -----------
2 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index a9a4831a9..8ce370938 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -352,24 +352,12 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
@Override
public void onMediaUpdated(final MediaWrapper[] mediaList) {
- updateItems(mediaList);
+ mAdapter.add(mediaList);
}
@Override
public void onMediaAdded(final MediaWrapper[] mediaList) {
- updateItems(mediaList);
- }
-
- public void updateItems(final MediaWrapper[] mediaList) {
- for (final MediaWrapper mw : mediaList)
- if (mw != null && mw.getType() == MediaWrapper.TYPE_VIDEO)
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mAdapter.update(mw);
- updateEmptyView();
- }
- });
+ mAdapter.add(mediaList);
}
@MainThread
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index af5b94fa9..82361c5bd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -210,17 +210,6 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
}
@MainThread
- public void update(MediaWrapper item) {
- int position = mDataset.indexOf(item);
- if (position != -1) {
- if (!(mDataset.get(position) instanceof MediaGroup))
- mDataset.set(position, item);
- notifyItemChanged(position, UPDATE_THUMB);
- } else
- add(item);
- }
-
- @MainThread
public void clear() {
mDataset.clear();
mOriginalData = null;
More information about the Android
mailing list