[Android] Less notification update

Geoffrey Métais git at videolan.org
Fri Mar 18 10:06:49 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 18 10:05:59 2016 +0100| [a81e8eb1700926bd1fc8bee4c2820f233d66f022] | committer: Geoffrey Métais

Less notification update

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index be65af6..25317b5 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -538,6 +538,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     private final Media.EventListener mMediaListener = new Media.EventListener() {
         @Override
         public void onEvent(Media.Event event) {
+            boolean update = true;
             switch (event.type) {
                 case Media.Event.MetaChanged:
                     /* Update Meta if file is already parsed */
@@ -550,10 +551,16 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
                     updateCurrentMeta(-1);
                     mParsed = true;
                     break;
+                default:
+                    update = false;
 
             }
-            for (Callback callback : mCallbacks)
-                callback.onMediaEvent(event);
+            if (update) {
+                for (Callback callback : mCallbacks)
+                    callback.onMediaEvent(event);
+                if (mParsed)
+                    showNotification();
+            }
         }
     };
 
@@ -615,6 +622,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
                     executeUpdate();
                     publishState(event.type);
                     executeUpdateProgress();
+                    showNotification();
                     if (mWakeLock.isHeld())
                         mWakeLock.release();
                     break;
@@ -1132,7 +1140,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
             i.putExtra("track", media.getTitle());
             sendBroadcast(i);
         }
-        showNotification();
     }
 
     protected void publishState(int state) {



More information about the Android mailing list