Created
March 23, 2022 22:52
-
-
Save mattttvaughn/221767c2613ddc1848ea48b00b9377b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
private val prefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> | |
when (key) { | |
PrefsRepo.KEY_SKIP_SILENCE, PrefsRepo.KEY_PLAYBACK_SPEED -> { | |
invalidatePlaybackParams() | |
} | |
PrefsRepo.KEY_PAUSE_ON_FOCUS_LOST -> { | |
updateAudioAttrs(exoPlayer) | |
} | |
// \/ \/ Add below \/ \/ | |
PrefsRepo.KEY_JUMP_FORWARD_SECONDS, PrefsRepo.KEY_JUMP_BACKWARD_SECONDS -> { | |
serviceScope.launch { | |
withContext(Dispatchers.IO) { | |
sessionToken?.let { | |
val notification = notificationBuilder.buildNotification(it) | |
startForeground(NOW_PLAYING_NOTIFICATION, notification) | |
} | |
} | |
} | |
} | |
} | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just do the same thing you had done to make the notif use current speed icons on each notification build, example below | |
private fun skipBackwardsAction() = NotificationCompat.Action( | |
getJumpBackwardIcon(), | |
context.getString(R.string.skip_backwards), | |
makePendingIntent(mediaSkipBackwardCode) | |
) | |
... | |
builder.addAction(skipBackwardsAction()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment