Merge pull request #6645 from Bnyro/master

fix: unexpected behavior in offline audio player fragment
This commit is contained in:
Bnyro 2024-10-21 12:35:42 +02:00 committed by GitHub
commit ebc502f38d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -58,12 +58,7 @@ class NoInternetActivity : BaseActivity() {
super.onNewIntent(intent)
if (intent.getBooleanExtra(IntentData.openAudioPlayer, false)) {
// attempt to recycle already existing audio player fragment first before creating new one
supportFragmentManager.fragments.filterIsInstance<AudioPlayerFragment>().firstOrNull()?.let {
it.binding.playerMotionLayout.transitionToStart()
return
}
NavigationHelper.startAudioPlayer(this)
NavigationHelper.startAudioPlayer(this, offlinePlayer = true)
}
}
}

View File

@ -298,6 +298,8 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
* Load the information from a new stream into the UI
*/
private fun updateStreamInfo(stream: StreamItem? = null) {
val binding = _binding ?: return
val current = stream ?: PlayingQueue.getCurrent() ?: return
binding.title.text = current.title
@ -380,6 +382,8 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
private fun updatePlayPauseButton() {
playerService?.player?.let {
val binding = _binding ?: return
val iconRes = PlayerHelper.getPlayPauseActionIcon(it)
binding.playPause.setIconResource(iconRes)
binding.miniPlayerPause.setImageResource(iconRes)