[Android] Set 'clear mediadatabase' to reload medialibrary

Geoffrey Métais git at videolan.org
Thu Nov 24 17:28:44 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 24 17:28:16 2016 +0100| [7bb5fc3fe18da6c0c450b5540683c6d024323e0d] | committer: Geoffrey Métais

Set 'clear mediadatabase' to reload medialibrary

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

 .../src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java    | 4 +---
 .../src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
index ed58968..910fd72 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
@@ -42,7 +42,6 @@ import org.videolan.vlc.gui.DebugLogActivity;
 import org.videolan.vlc.gui.helpers.AudioUtil;
 import org.videolan.vlc.gui.helpers.BitmapCache;
 import org.videolan.vlc.gui.helpers.UiTools;
-import org.videolan.vlc.media.MediaDatabase;
 import org.videolan.vlc.util.VLCInstance;
 
 public class PreferencesAdvanced extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@@ -116,10 +115,9 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
                         .setNegativeButton(android.R.string.cancel, null).show();
                 return true;
             case "clear_media_db":
-                MediaDatabase.getInstance().emptyDatabase();
+                VLCApplication.getMLInstance().reload();
                 BitmapCache.getInstance().clear();
                 AudioUtil.clearCacheFolders();
-                getActivity().setResult(PreferencesActivity.RESULT_RESCAN);
                 UiTools.snacker(getView(), R.string.media_db_cleared);
                 return true;
             case "quit_app":
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
index 618c4b3..134d5da 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
@@ -45,7 +45,6 @@ import org.videolan.vlc.gui.DebugLogActivity;
 import org.videolan.vlc.gui.helpers.AudioUtil;
 import org.videolan.vlc.gui.helpers.BitmapCache;
 import org.videolan.vlc.gui.helpers.UiTools;
-import org.videolan.vlc.media.MediaDatabase;
 import org.videolan.vlc.util.VLCInstance;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@@ -116,14 +115,12 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
                                 VLCApplication.getMLInstance().clearHistory();
                             }
                         })
-
                         .setNegativeButton(android.R.string.cancel, null).show();
                 return true;
             case "clear_media_db":
-                MediaDatabase.getInstance().emptyDatabase();
+                VLCApplication.getMLInstance().reload();
                 BitmapCache.getInstance().clear();
                 AudioUtil.clearCacheFolders();
-                getActivity().setResult(PreferencesActivity.RESULT_RESCAN);
                 Toast.makeText(VLCApplication.getAppContext(), R.string.media_db_cleared, Toast.LENGTH_SHORT).show();
                 return true;
             case "quit_app":



More information about the Android mailing list