[Android] Media style notifs for everyone on Lollipop+

Geoffrey Métais git at videolan.org
Thu Nov 2 11:09:04 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 31 16:47:16 2017 +0100| [fa5d73cc121337f9da91b9ec8c9b4f942b7132b3] | committer: Geoffrey Métais

Media style notifs for everyone on Lollipop+

Some manufacturers where banned from having a mediastyle notification.
Let's assume starting Lollipop they did things right

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

 .../src/org/videolan/vlc/gui/helpers/NotificationHelper.java | 12 +++++-------
 vlc-android/src/org/videolan/vlc/util/AndroidDevices.java    |  7 ++++---
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
index efbc8cbee..da281063e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
@@ -79,13 +79,11 @@ public class NotificationHelper {
             builder.addAction(R.drawable.ic_widget_next_w, ctx.getString(R.string.next), piForward);
             builder.addAction(R.drawable.ic_widget_close_w, ctx.getString(R.string.stop), piStop);
 
-            if (AndroidDevices.showMediaStyle) {
-                final Notification.MediaStyle ms = new Notification.MediaStyle()
-                        .setShowActionsInCompactView(0,1,2);
-                if (sessionToken != null)
-                    ms.setMediaSession((MediaSession.Token) sessionToken.getToken());
-                builder.setStyle(ms);
-            }
+            final Notification.MediaStyle ms = new Notification.MediaStyle()
+                    .setShowActionsInCompactView(0,1,2);
+            if (sessionToken != null)
+                ms.setMediaSession((MediaSession.Token) sessionToken.getToken());
+            builder.setStyle(ms);
             return builder.build();
         } else {
             final NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index 1926d846a..ff975ac1d 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -204,9 +204,10 @@ public class AndroidDevices {
     }
 
     private static boolean isManufacturerBannedForMediastyleNotifications() {
-        for (String manufacturer : noMediaStyleManufacturers)
-            if (Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains(manufacturer))
-                return true;
+        if (!AndroidUtil.isLolliPopOrLater)
+            for (String manufacturer : noMediaStyleManufacturers)
+                if (Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains(manufacturer))
+                    return true;
         return false;
     }
 



More information about the Android mailing list