From 921ded86a9c3feee5db24fcda06186f780ee94f1 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 31 Aug 2015 18:04:00 -0700 Subject: Fix notification x not working while paused + flicker in persistent notification switching from playing to paused --- .../main/java/github/daneren2005/dsub/util/Notifications.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java index ac812a53..499e2189 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java @@ -53,6 +53,7 @@ public final class Notifications { private static boolean playShowing = false; private static boolean downloadShowing = false; private static boolean downloadForeground = false; + private static boolean persistentPlayingShowing = false; private final static Pair NOTIFICATION_TEXT_COLORS = new Pair(); @@ -103,8 +104,9 @@ public final class Notifications { downloadService.startForeground(NOTIFICATION_ID_PLAYING, notification); } else { playShowing = false; + persistentPlayingShowing = true; NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - downloadService.stopForeground(true); + downloadService.stopForeground(false); notificationManager.notify(NOTIFICATION_ID_PLAYING, notification); } } @@ -220,6 +222,12 @@ public final class Notifications { @Override public void run() { downloadService.stopForeground(true); + + if(persistentPlayingShowing) { + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.cancel(NOTIFICATION_ID_PLAYING); + persistentPlayingShowing = false; + } } }); -- cgit v1.2.3