[Android] Do not show notification when a video is displayed

Geoffrey Métais git at videolan.org
Mon Mar 7 15:46:38 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar  7 15:45:40 2016 +0100| [d470d422f2283e09147f64e70069feae3cadc4b8] | committer: Geoffrey Métais

Do not show notification when a video is displayed

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index a472423..308a1a2 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -826,8 +826,10 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
 
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
     private void showNotification() {
-        if (mMediaPlayer.getVLCVout().areViewsAttached())
+        if (mMediaPlayer.getVLCVout().areViewsAttached()) {
+            hideNotification(false);
             return;
+        }
         try {
             boolean coverOnLockscreen = mSettings.getBoolean("lockscreen_cover", true);
             MediaMetadataCompat metaData = mMediaSession.getController().getMetadata();
@@ -920,6 +922,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
      */
     private void hideNotification(boolean stopPlayback) {
         stopForeground(true);
+        NotificationManagerCompat.from(this).cancelAll();
         if(stopPlayback)
             stopSelf();
     }
@@ -1686,7 +1689,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
                 mMediaPlayer.setTime(mSavedTime);
             mSavedTime = 0l;
 
-            notifyTrackChanged();
             determinePrevAndNextIndices();
             if (mSettings.getBoolean(PreferencesFragment.PLAYBACK_HISTORY, true))
                 VLCApplication.runBackground(new Runnable() {



More information about the Android mailing list