Added custom actions
This commit is contained in:
parent
6fde42ba11
commit
ce30e1ebbe
4 changed files with 22 additions and 17 deletions
|
@ -20,11 +20,12 @@ import android.os.Bundle
|
|||
import android.support.v4.media.session.MediaSessionCompat
|
||||
import code.name.monkey.retromusic.auto.AutoMediaIDHelper
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.cycleRepeatMode
|
||||
import code.name.monkey.retromusic.helper.ShuffleHelper
|
||||
import code.name.monkey.retromusic.loaders.*
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.providers.MusicPlaybackQueueStore
|
||||
import code.name.monkey.retromusic.service.MusicService.TOGGLE_FAVORITE
|
||||
import code.name.monkey.retromusic.service.MusicService.*
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import java.util.*
|
||||
|
||||
|
@ -125,16 +126,15 @@ class MediaSessionCallback(private val context: Context,
|
|||
|
||||
override fun onCustomAction(action: String, extras: Bundle?) {
|
||||
when (action) {
|
||||
/* CYCLE_REPEAT -> {
|
||||
cycleRepeatMode()
|
||||
musicService.updateMediaSessionPlaybackState()
|
||||
}
|
||||
CYCLE_REPEAT -> {
|
||||
cycleRepeatMode()
|
||||
musicService.updateMediaSessionPlaybackState()
|
||||
}
|
||||
|
||||
TOGGLE_SHUFFLE -> {
|
||||
musicService.toggleShuffle()
|
||||
musicService.updateMediaSessionPlaybackState()
|
||||
}
|
||||
*/
|
||||
TOGGLE_SHUFFLE -> {
|
||||
musicService.toggleShuffle()
|
||||
musicService.updateMediaSessionPlaybackState()
|
||||
}
|
||||
TOGGLE_FAVORITE -> {
|
||||
MusicUtil.toggleFavorite(context, MusicPlayerRemote.currentSong)
|
||||
musicService.updateMediaSessionPlaybackState()
|
||||
|
|
|
@ -464,6 +464,7 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
unregisterReceiver(widgetIntentReceiver);
|
||||
unregisterReceiver(updateFavoriteReceiver);
|
||||
if (becomingNoisyReceiverRegistered) {
|
||||
unregisterReceiver(becomingNoisyReceiver);
|
||||
becomingNoisyReceiverRegistered = false;
|
||||
|
|
|
@ -153,13 +153,13 @@ class PlayingNotificationOreo : PlayingNotification() {
|
|||
val secondary = MaterialValueHelper.getSecondaryTextColor(service, dark)
|
||||
|
||||
val close = createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_close_white_24dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
val prev = createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
val next = createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
val prev = createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_round_white_32dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
val next = createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_round_white_32dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
val playPause = createBitmap(RetroUtil.getTintedVectorDrawable(service,
|
||||
if (isPlaying)
|
||||
R.drawable.ic_pause_white_24dp
|
||||
R.drawable.ic_pause_white_48dp
|
||||
else
|
||||
R.drawable.ic_play_arrow_white_32dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
R.drawable.ic_play_arrow_white_48dp, primary)!!, NOTIFICATION_CONTROLS_SIZE_MULTIPLIER)
|
||||
|
||||
notificationLayout.setTextColor(R.id.title, primary)
|
||||
notificationLayout.setTextColor(R.id.subtitle, secondary)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue