[Android] Fix notification not shown on medialib reload

Geoffrey Métais git at videolan.org
Wed Feb 15 16:10:52 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 15 11:23:52 2017 +0100| [0beee9703de93e1d4cfee92a8c91e4d39edf0e72] | committer: Geoffrey Métais

Fix notification not shown on medialib reload

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index 772fbc9..87c0dc5 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -40,7 +40,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
 
     private final IBinder mBinder = new LocalBinder();
     private Medialibrary mMedialibrary;
-    private int mParsing = 0;
+    private int mParsing = 0, mReload = 0;
     private String mCurrentProgress = null;
     private long mLastNotificationTime;
     private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@@ -95,6 +95,8 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
     }
 
     private void reload() {
+        if (mReload > 0)
+            return;
         mMedialibrary.addDeviceDiscoveryCb(MediaParsingService.this);
         mMedialibrary.reload();
     }
@@ -210,12 +212,17 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
 
     @Override
     public void onReloadStarted(String entryPoint) {
+        if (TextUtils.isEmpty(entryPoint))
+            ++mReload;
+        mLastNotificationTime = System.currentTimeMillis();
         showNotification();
     }
 
     @Override
     public void onReloadCompleted(String entryPoint) {
-        if (mCurrentProgress != null && mParsing == 0) {
+        if (TextUtils.isEmpty(entryPoint))
+            --mReload;
+        if (mParsing == 0) {
             stopSelf();
         }
     }



More information about the Android mailing list