[Android] do not empty the DB if storage is not mounted
Sébastien Toque
git at videolan.org
Sat May 12 08:37:45 CEST 2012
android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat May 12 08:37:35 2012 +0200| [e75ffd9b23456867f90ad958e1c749a40e70f40a] | committer: Sébastien Toque
do not empty the DB if storage is not mounted
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=e75ffd9b23456867f90ad958e1c749a40e70f40a
---
vlc-android/src/org/videolan/vlc/MediaLibrary.java | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 2312c4a..74a2db5 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -249,12 +249,14 @@ public class MediaLibrary {
h.sendEmptyMessage(MEDIA_ITEMS_UPDATED);
}
- // remove file from database
- for (String fileURI : addedLocations) {
- existingMedias.remove(fileURI);
- }
- for (String existingMedia : existingMedias.keySet()) {
- mDBManager.removeMedia(existingMedia);
+ // remove file from database if storage is mounted
+ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ for (String fileURI : addedLocations) {
+ existingMedias.remove(fileURI);
+ }
+ for (String existingMedia : existingMedias.keySet()) {
+ mDBManager.removeMedia(existingMedia);
+ }
}
// hide progressbar in header
More information about the Android
mailing list