diff options
author | avm99963 <me@avm99963.com> | 2020-09-15 20:29:42 +0200 |
---|---|---|
committer | avm99963 <me@avm99963.com> | 2020-09-15 22:29:21 +0200 |
commit | e9b82d2c36cd4f546c30b5964d762972f920042a (patch) | |
tree | 70602d49923a6f5260d11d6597c6db2182e9e337 /app/src/main/java/github/daneren2005/dsub/service | |
parent | c303ca3e0c1bae25a770c4fc7f680310f0eee237 (diff) | |
download | dsub-e9b82d2c36cd4f546c30b5964d762972f920042a.tar.gz dsub-e9b82d2c36cd4f546c30b5964d762972f920042a.tar.bz2 dsub-e9b82d2c36cd4f546c30b5964d762972f920042a.zip |
Add the option to display MediaStyle notifications
Android now has the capability of displaying MediaStyle notifications
which are better aligned with the Material Design standards and blend
better into the OS than custom notifications.
This commit adds an option in the Playback section to show notifications
using the MediaStyle style.
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/service')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index e9096900..5c077b1e 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1519,12 +1519,14 @@ public class DownloadService extends Service { Util.requestAudioFocus(this, audioManager); } + SharedPreferences prefs = Util.getPreferences(this); + boolean usingMediaStyleNotification = prefs.getBoolean(Constants.PREFERENCES_KEY_MEDIA_STYLE_NOTIFICATION, false) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; + if (show) { - Notifications.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + Notifications.showPlayingNotification(this, this, handler, currentPlaying.getSong(), usingMediaStyleNotification); } else if (pause) { - SharedPreferences prefs = Util.getPreferences(this); - if(prefs.getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) { - Notifications.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + if (prefs.getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false) || usingMediaStyleNotification) { + Notifications.showPlayingNotification(this, this, handler, currentPlaying.getSong(), usingMediaStyleNotification); } else { Notifications.hidePlayingNotification(this, this, handler); } |