[Android] MediaLibrary: add custom path support
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 11:35:16 2012 -0500| [dad224763ac6667a6d7a5b2a0565fc08314e59b0] | committer: Edward Wang
MediaLibrary: add custom path support
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=dad224763ac6667a6d7a5b2a0565fc08314e59b0
---
vlc-android/src/org/videolan/vlc/MediaLibrary.java | 2 +-
vlc-android/src/org/videolan/vlc/Util.java | 7 +++++++
vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java | 4 ++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index cd85042..0fe518e 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -200,7 +200,7 @@ public class MediaLibrary {
List<File> mediaDirs = DBManager.getMediaDirs();
if (mediaDirs.size() == 0) {
// Use all available storage directories as our default
- String storageDirs[] = Util.getStorageDirectories();
+ String storageDirs[] = Util.getMediaDirectories();
for (String dir: storageDirs) {
File f = new File(dir);
if (f.exists())
diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 2898a5a..0e1df63 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -461,6 +461,13 @@ public class Util {
return custom_paths.split(":");
}
+ public static String[] getMediaDirectories() {
+ ArrayList<String> list = new ArrayList<String>();
+ list.addAll(Arrays.asList(Util.getStorageDirectories()));
+ list.addAll(Arrays.asList(Util.getCustomDirectories()));
+ return list.toArray(new String[list.size()]);
+ }
+
public static void addCustomDirectory(String path) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index 02e4dad..096fd07 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -135,7 +135,7 @@ public class DirectoryAdapter extends BaseAdapter {
public void populateNode(DirectoryAdapter.Node n, String path) {
if (path == null) {
// We're on the storage list
- String storages[] = Util.getStorageDirectories();
+ String storages[] = Util.getMediaDirectories();
for (String storage : storages) {
File f = new File(storage);
DirectoryAdapter.Node child = new DirectoryAdapter.Node(f.getName(), getVisibleName(f));
@@ -309,7 +309,7 @@ public class DirectoryAdapter extends BaseAdapter {
public boolean browse(String directoryName) {
if (this.mCurrentDir == null) {
// We're on the storage list
- String storages[] = Util.getStorageDirectories();
+ String storages[] = Util.getMediaDirectories();
for (String storage : storages) {
storage = Util.stripTrailingSlash(storage);
if (storage.endsWith(directoryName)) {
More information about the Android
mailing list