[Android] Quick access for Whatsapp videos

Geoffrey Métais git at videolan.org
Fri Dec 8 14:47:50 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec  8 11:47:27 2017 +0100| [155b66ccf3d2d622b62b1d4c68cc63a6350c5c8c] | committer: Geoffrey Métais

Quick access for Whatsapp videos

> https://code.videolan.org/videolan/vlc-android/commit/155b66ccf3d2d622b62b1d4c68cc63a6350c5c8c
---

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 3 ++-
 .../src/org/videolan/vlc/gui/browser/FileBrowserFragment.java        | 5 +++++
 vlc-android/src/org/videolan/vlc/util/AndroidDevices.java            | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 857ab28fd..91260a1e3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -311,7 +311,8 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
             case MediaWrapper.TYPE_DIR:
                 if (specialFolders) {
                     final Uri uri = media.getUri();
-                    if (AndroidDevices.MediaFolders.EXTERNAL_PUBLIC_MOVIES_DIRECTORY_URI.equals(uri))
+                    if (AndroidDevices.MediaFolders.EXTERNAL_PUBLIC_MOVIES_DIRECTORY_URI.equals(uri)
+                            || AndroidDevices.MediaFolders.WHATSAPP_VIDEOS_FILE_URI.equals(uri))
                         return IMAGE_QA_MOVIES;
                     if (AndroidDevices.MediaFolders.EXTERNAL_PUBLIC_MUSIC_DIRECTORY_URI.equals(uri))
                         return IMAGE_QA_MUSIC;
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
index da6e2564f..d0a35b133 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
@@ -138,6 +138,11 @@ public class FileBrowserFragment extends BaseBrowserFragment {
                         downloads.setType(MediaWrapper.TYPE_DIR);
                         devices.add(downloads);
                     }
+                    if (AndroidDevices.MediaFolders.WHATSAPP_VIDEOS_FILE.exists()) {
+                        final MediaWrapper whatsapp = new MediaWrapper(AndroidDevices.MediaFolders.WHATSAPP_VIDEOS_FILE_URI);
+                        whatsapp.setType(MediaWrapper.TYPE_DIR);
+                        devices.add(whatsapp);
+                    }
                 }
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index 312016491..bf67a1602 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -225,11 +225,13 @@ public class AndroidDevices {
         public final static File EXTERNAL_PUBLIC_MUSIC_DIRECTORY_FILE = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
         public final static File EXTERNAL_PUBLIC_PODCAST_DIRECTORY_FILE = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PODCASTS);
         public final static File EXTERNAL_PUBLIC_DOWNLOAD_DIRECTORY_FILE = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
+        public final static File WHATSAPP_VIDEOS_FILE = new File(EXTERNAL_PUBLIC_DIRECTORY+"/WhatsApp/Media/WhatsApp Video/");
 
         public final static Uri EXTERNAL_PUBLIC_MOVIES_DIRECTORY_URI = getFolderUri(EXTERNAL_PUBLIC_MOVIES_DIRECTORY_FILE);
         public final static Uri EXTERNAL_PUBLIC_MUSIC_DIRECTORY_URI = getFolderUri(EXTERNAL_PUBLIC_MUSIC_DIRECTORY_FILE);
         public final static Uri EXTERNAL_PUBLIC_PODCAST_DIRECTORY_URI = getFolderUri(EXTERNAL_PUBLIC_PODCAST_DIRECTORY_FILE);
         public final static Uri EXTERNAL_PUBLIC_DOWNLOAD_DIRECTORY_URI = getFolderUri(EXTERNAL_PUBLIC_DOWNLOAD_DIRECTORY_FILE);
+        public final static Uri WHATSAPP_VIDEOS_FILE_URI = getFolderUri(WHATSAPP_VIDEOS_FILE);
 
         private static Uri getFolderUri(File file) {
             try {



More information about the Android mailing list