[Android] Fix StorageBrowser display

Geoffrey Métais git at videolan.org
Wed Dec 14 14:42:35 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 14 14:42:06 2016 +0100| [3e0de13130b57a7304b27ede98803471fae4b195] | committer: Geoffrey Métais

Fix StorageBrowser display

> https://code.videolan.org/videolan/vlc-android/commit/3e0de13130b57a7304b27ede98803471fae4b195
---

 .../org/videolan/vlc/gui/browser/StorageBrowserFragment.java  | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
index 3c9c7ea..77e71ed 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -45,6 +45,7 @@ import org.videolan.vlc.util.AndroidDevices;
 import org.videolan.vlc.util.CustomDirectories;
 
 import java.io.File;
+import java.util.ArrayList;
 
 public class StorageBrowserFragment extends FileBrowserFragment {
 
@@ -113,13 +114,14 @@ public class StorageBrowserFragment extends FileBrowserFragment {
         String[] storages = mMediaLibrary.getDevices();
         String[] customDirectories = CustomDirectories.getCustomDirectories();
         Storage storage;
+        ArrayList storagesList = new ArrayList();
         for (String mediaDirLocation : storages) {
             if (TextUtils.isEmpty(mediaDirLocation))
                 continue;
             storage = new Storage(Uri.fromFile(new File(mediaDirLocation)));
             if (TextUtils.equals(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY, mediaDirLocation))
                 storage.setName(getString(R.string.internal_memory));
-            mAdapter.addItem(storage, false, false);
+            storagesList.add(storage);
         }
         customLoop:
         for (String customDir : customDirectories) {
@@ -130,13 +132,10 @@ public class StorageBrowserFragment extends FileBrowserFragment {
                     continue customLoop;
             }
             storage = new Storage(Uri.parse(customDir));
-            mAdapter.addItem(storage, false, false);
+            storagesList.add(storage);
         }
         mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
-        if (mReadyToDisplay) {
-            updateEmptyView();
-            mAdapter.notifyDataSetChanged();
-        }
+        mAdapter.dispatchUpdate(storagesList);
     }
 
     @Override



More information about the Android mailing list