Do not expand player when queue is restored (#396)
This commit is contained in:
parent
ff611d792e
commit
fae96d1114
3 changed files with 11 additions and 5 deletions
|
@ -359,9 +359,9 @@ class MainActivity : ComponentActivity() {
|
|||
if (playerBottomSheetState.isDismissed) {
|
||||
if (launchedFromNotification) {
|
||||
intent.replaceExtras(Bundle())
|
||||
playerBottomSheetState.expandSoft()
|
||||
playerBottomSheetState.expand(tween(700))
|
||||
} else {
|
||||
playerBottomSheetState.collapseSoft()
|
||||
playerBottomSheetState.collapse(tween(700))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +369,11 @@ class MainActivity : ComponentActivity() {
|
|||
player.listener(object : Player.Listener {
|
||||
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
|
||||
if (reason == Player.MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED && mediaItem != null) {
|
||||
if (mediaItem.mediaMetadata.extras?.getBoolean("isFromPersistentQueue") != true) {
|
||||
playerBottomSheetState.expand(tween(500))
|
||||
} else {
|
||||
playerBottomSheetState.collapse(tween(700))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -377,7 +377,9 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
|
|||
mediaItem.mediaItem.buildUpon()
|
||||
.setUri(mediaItem.mediaItem.mediaId)
|
||||
.setCustomCacheKey(mediaItem.mediaItem.mediaId)
|
||||
.build()
|
||||
.build().apply {
|
||||
mediaMetadata.extras?.putBoolean("isFromPersistentQueue", true)
|
||||
}
|
||||
},
|
||||
index,
|
||||
queuedSong[index].position ?: C.TIME_UNSET
|
||||
|
|
|
@ -129,7 +129,7 @@ class BottomSheetState(
|
|||
1f - (animatable.upperBound!! - animatable.value) / (animatable.upperBound!! - collapsedBound)
|
||||
}
|
||||
|
||||
private fun collapse(animationSpec: AnimationSpec<Dp>) {
|
||||
fun collapse(animationSpec: AnimationSpec<Dp>) {
|
||||
onAnchorChanged(collapsedAnchor)
|
||||
coroutineScope.launch {
|
||||
animatable.animateTo(collapsedBound, animationSpec)
|
||||
|
|
Loading…
Reference in a new issue