[Android] Fix Storage browser and FilePicker

Geoffrey Métais git at videolan.org
Mon Jan 18 11:43:40 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 18 11:43:13 2016 +0100| [56299ca2ba3ed720e0ce4da811a4c3f6d9d4c263] | committer: Geoffrey Métais

Fix Storage browser and FilePicker

> https://code.videolan.org/videolan/vlc-android/commit/56299ca2ba3ed720e0ce4da811a4c3f6d9d4c263
---

 .../src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java     | 3 ---
 .../src/org/videolan/vlc/gui/browser/FilePickerAdapter.java      | 4 ++--
 .../src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java  | 9 +++++----
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 1c3b3bc..b1935c5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -225,7 +225,6 @@ public class BaseBrowserAdapter extends  RecyclerView.Adapter<RecyclerView.ViewH
 
     public void addItem(Object item, boolean notify, boolean top){
         addItem(item, notify, top, -1);
-
     }
 
     public void addItem(Object item, boolean notify, int position){
@@ -244,8 +243,6 @@ public class BaseBrowserAdapter extends  RecyclerView.Adapter<RecyclerView.ViewH
 
         if (item instanceof MediaWrapper && ((MediaWrapper)item).getTitle().startsWith("."))
             return;
-        else if (item instanceof Media)
-            item = new MediaWrapper((Media) item);
 
         mMediaList.add(position, item);
         if (notify)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
index 49f3bb1..c625903 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerAdapter.java
@@ -35,8 +35,8 @@ public class FilePickerAdapter extends BaseBrowserAdapter {
         super(fragment);
     }
 
-    public void addItem(Media media, boolean notify, boolean top){
-        MediaWrapper mediaWrapper = new MediaWrapper(media);
+    public void addItem(Object media, boolean notify, boolean top){
+        MediaWrapper mediaWrapper = new MediaWrapper((Media)media);
         if (filter(mediaWrapper))
             addItem(mediaWrapper, notify, top);
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
index 122d824..0c4676f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
@@ -31,9 +31,9 @@ import android.view.ViewGroup;
 import android.widget.CheckBox;
 
 import org.videolan.libvlc.Media;
-import org.videolan.vlc.media.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.media.MediaWrapper;
 
 public class StorageBrowserAdapter extends BaseBrowserAdapter {
 
@@ -82,9 +82,10 @@ public class StorageBrowserAdapter extends BaseBrowserAdapter {
             vh.setContextMenuListener();
     }
 
-    public void addItem(Media media, boolean notify, boolean top){
-        Storage storage = new Storage(media.getUri());
-        addItem(storage, notify, top);
+    public void addItem(Object item, boolean notify, boolean top){
+        if (item instanceof Media)
+            item = new Storage(((Media)item).getUri());
+        super.addItem(item, notify, top);
     }
 
     private void removeDir(final String path) {



More information about the Android mailing list