[Android] Rescan media in video&audio views refresh

Geoffrey Métais git at videolan.org
Mon Dec 5 15:32:12 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  5 15:29:20 2016 +0100| [e90b72bfcbbe5fffe94cd9b42cb3e237e719fb82] | committer: Geoffrey Métais

Rescan media in video&audio views refresh

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

 .../org/videolan/vlc/gui/audio/AudioBrowserFragment.java    |  4 +---
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java   | 13 ++++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 7d80cbb..37314f7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -409,9 +409,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
     @Override
     public void onRefresh() {
         mMainActivity.closeSearchView();
-        if (!mMediaLibrary.isWorking()) {
-            updateLists();
-        }
+        mMediaLibrary.reload();
     }
 
     @Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 88b5da7..3d04fdf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -417,10 +417,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
 
     @Override
     public void onRefresh() {
-        if (!mMediaLibrary.isWorking())
-           updateList();
-        else
-            mSwipeRefreshLayout.setRefreshing(false);
+        mMediaLibrary.reload();
     }
 
     @Override
@@ -438,7 +435,9 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
     public void onDiscoveryProgress(String entryPoint) {}
 
     @Override
-    public void onDiscoveryCompleted(final String entryPoint) {}
+    public void onDiscoveryCompleted(final String entryPoint) {
+        mHandler.sendEmptyMessage(mParsing ? SET_REFRESHING : UNSET_REFRESHING);
+    }
 
     @Override
     public void onParsingStatsUpdated(final int percent) {
@@ -531,6 +530,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
 
     private static final int UPDATE_LIST = 14;
     private static final int SET_REFRESHING = 15;
+    private static final int UNSET_REFRESHING = 16;
     private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -542,6 +542,9 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
                 case SET_REFRESHING:
                     mSwipeRefreshLayout.setRefreshing(true);
                     break;
+                case UNSET_REFRESHING:
+                    mSwipeRefreshLayout.setRefreshing(false);
+                    break;
                 default:
                     super.handleMessage(msg);
             }



More information about the Android mailing list