[Android] Ban folders once medialibrary is ready

Geoffrey Métais git at videolan.org
Thu Apr 20 17:08:45 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 20 17:08:05 2017 +0200| [7f1fdf1feac104a2a30ab08d2d94e7b9b1748f54] | committer: Geoffrey Métais

Ban folders once medialibrary is ready

> https://code.videolan.org/videolan/vlc-android/commit/7f1fdf1feac104a2a30ab08d2d94e7b9b1748f54
---

 vlc-android/src/org/videolan/vlc/MediaParsingService.java | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index 753cbb2..3dd4fbf 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -191,12 +191,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
                         for (String device : devices) {
                             boolean isMainStorage = TextUtils.equals(device, AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
                             boolean isNew = mMedialibrary.addDevice(isMainStorage ? "main-storage" : FileUtils.getFileNameFromPath(device), device, !isMainStorage);
-                            if (isMainStorage) {
-                                if (shouldInit) {
-                                    for (String folder : Medialibrary.getBlackList())
-                                        mMedialibrary.banFolder(device + folder);
-                                }
-                            } else if (isNew) {
+                            if (!isMainStorage && isNew) {
                                     startActivity(new Intent(MediaParsingService.this, DialogActivity.class)
                                             .setAction(DialogActivity.KEY_STORAGE)
                                             .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -206,9 +201,11 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
                         }
                         mMedialibrary.start();
                         LocalBroadcastManager.getInstance(MediaParsingService.this).sendBroadcast(new Intent(VLCApplication.ACTION_MEDIALIBRARY_READY));
-                        if (shouldInit)
+                        if (shouldInit) {
+                            for (String folder : Medialibrary.getBlackList())
+                                mMedialibrary.banFolder(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + folder);
                             mMedialibrary.discover(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
-                        else if (upgrade)
+                        } else if (upgrade)
                             mMedialibrary.forceParserRetry();
                     }
                     initOngoing = false;



More information about the Android mailing list