Add option to toggle notification design in N+ (#106)
This commit is contained in:
parent
abb2c21add
commit
964de0e720
5 changed files with 80 additions and 17 deletions
|
|
@ -201,12 +201,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
|
||||
registerReceiver(widgetIntentReceiver, new IntentFilter(APP_WIDGET_UPDATE));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
playingNotification = new PlayingNotificationImpl24();
|
||||
} else {
|
||||
playingNotification = new PlayingNotificationImpl();
|
||||
}
|
||||
playingNotification.init(this);
|
||||
initNotification();
|
||||
|
||||
mediaStoreObserver = new MediaStoreObserver(playerHandler);
|
||||
throttledSeekHandler = new ThrottledSeekHandler(playerHandler);
|
||||
|
|
@ -557,8 +552,17 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
return (getAudioManager().requestAudioFocus(audioFocusListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED);
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
if (getCurrentSong().id != -1) {
|
||||
public void initNotification() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance(this).classicNotification()) {
|
||||
playingNotification = new PlayingNotificationImpl24();
|
||||
} else {
|
||||
playingNotification = new PlayingNotificationImpl();
|
||||
}
|
||||
playingNotification.init(this);
|
||||
}
|
||||
|
||||
public void updateNotification() {
|
||||
if (playingNotification != null && getCurrentSong().id != -1) {
|
||||
playingNotification.update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue