[Android] Remove subfolders while adding a directory

Geoffrey Métais git at videolan.org
Tue May 12 16:39:18 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 12 16:38:43 2015 +0200| [91613e91c18cfc5293531f1ba5979c4193687482] | committer: Geoffrey Métais

Remove subfolders while adding a directory

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=91613e91c18cfc5293531f1ba5979c4193687482
---

 .../videolan/vlc/gui/browser/StorageBrowserAdapter.java |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

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 f320dc5..ccfd8f0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
@@ -33,7 +33,6 @@ import android.widget.CheckBox;
 import org.videolan.libvlc.Media;
 import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
-import org.videolan.vlc.util.Strings;
 
 public class StorageBrowserAdapter extends BaseBrowserAdapter {
 
@@ -138,10 +137,16 @@ public class StorageBrowserAdapter extends BaseBrowserAdapter {
             @Override
             public void run() {
                 mDbManager.addDir(path);
-                String parentPath = Strings.getParent(path);
-                while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
-                    mDbManager.removeDir(parentPath);
-                    parentPath = Strings.getParent(parentPath);
+                //No need to check for parents for now
+//                String parentPath = Strings.getParent(path);
+//                while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
+//                    mDbManager.removeDir(parentPath);
+//                    parentPath = Strings.getParent(parentPath);
+//                }
+                //Remove subfolders, it would be redundant
+                for (String customDirPath : mMediaDirsLocation) {
+                    if (customDirPath.startsWith(path+"/"))
+                        mDbManager.removeDir(customDirPath);
                 }
                 refreshFragment();
                 updateMediaDirs();



More information about the Android mailing list