From 06fb89fae2937fecd8b9bcabbf098885ab0c0fa1 Mon Sep 17 00:00:00 2001 From: Stypox Date: Mon, 5 Oct 2020 15:53:50 +0200 Subject: [PATCH 1/2] Fix crash on fast forward --- .../java/org/schabi/newpipe/player/NotificationUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java index 370631116..d9b2b4bad 100644 --- a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java @@ -148,7 +148,10 @@ public final class NotificationUtil { @SuppressLint("RestrictedApi") boolean shouldUpdateBufferingSlot() { - if (notificationBuilder.mActions.size() < 3) { + if (notificationBuilder == null) { + // if there is no notification active, there is no point in updating it + return false; + } else if (notificationBuilder.mActions.size() < 3) { // this should never happen, but let's make sure notification actions are populated return true; } From a88f5113e0c9dcff20fdfd0ad756e9374e3b1fa1 Mon Sep 17 00:00:00 2001 From: Stypox Date: Mon, 5 Oct 2020 15:57:14 +0200 Subject: [PATCH 2/2] Hide player notification "when" time It is useless to see how much time ago a player notification was created --- .../java/org/schabi/newpipe/player/NotificationUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java index d9b2b4bad..10fff5298 100644 --- a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java @@ -116,10 +116,11 @@ public final class NotificationUtil { .setMediaSession(player.mediaSessionManager.getSessionToken()) .setShowActionsInCompactView(compactSlots)) .setPriority(NotificationCompat.PRIORITY_HIGH) - .setSmallIcon(R.drawable.ic_newpipe_triangle_white) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - .setColor(ContextCompat.getColor(player.context, R.color.gray)) .setCategory(NotificationCompat.CATEGORY_TRANSPORT) + .setShowWhen(false) + .setSmallIcon(R.drawable.ic_newpipe_triangle_white) + .setColor(ContextCompat.getColor(player.context, R.color.gray)) .setDeleteIntent(PendingIntent.getBroadcast(player.context, NOTIFICATION_ID, new Intent(ACTION_CLOSE), FLAG_UPDATE_CURRENT));