[Android] BrowserActivity: remove orphaned directories when removing custom path

Edward Wang git at videolan.org
Sat Dec 29 19:33:10 CET 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Dec 29 13:26:25 2012 -0500| [dd9a393a6a8dc0deb08c5f96fb1a94ee39f21759] | committer: Edward Wang

BrowserActivity: remove orphaned directories when removing custom path

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

 vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
index b7f5d2f..7f851b1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Stack;
 
+import org.videolan.vlc.DatabaseManager;
 import org.videolan.vlc.Media;
 import org.videolan.vlc.R;
 import org.videolan.vlc.Util;
@@ -123,6 +124,12 @@ public class BrowserActivity extends ListActivity {
         delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
             @Override
             public boolean onMenuItemClick(MenuItem arg0) {
+                // remove any checkmarks of the custom item
+                final DatabaseManager dbManager = DatabaseManager.getInstance(BrowserActivity.this);
+                for(File f : dbManager.getMediaDirs()) {
+                    if(f.getPath().startsWith(item.getPath()))
+                        dbManager.removeDir(f.getPath());
+                }
                 Util.removeCustomDirectory(item.getPath());
                 refresh();
                 return true;



More information about the Android mailing list