diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-08-31 18:04:00 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-08-31 18:04:00 -0700 |
commit | 921ded86a9c3feee5db24fcda06186f780ee94f1 (patch) | |
tree | 8e046782965df06607c31e3b1b9d5675092051f4 /app/src/main | |
parent | 3e8c34bdebe67c83cc8108efd5d87348640001de (diff) | |
download | dsub-921ded86a9c3feee5db24fcda06186f780ee94f1.tar.gz dsub-921ded86a9c3feee5db24fcda06186f780ee94f1.tar.bz2 dsub-921ded86a9c3feee5db24fcda06186f780ee94f1.zip |
Fix notification x not working while paused + flicker in persistent notification switching from playing to paused
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Notifications.java | 10 |
1 files changed, 9 insertions, 1 deletions
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<Integer, Integer> NOTIFICATION_TEXT_COLORS = new Pair<Integer, Integer>(); @@ -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; + } } }); |