mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #6645 from Bnyro/master
fix: unexpected behavior in offline audio player fragment
This commit is contained in:
commit
ebc502f38d
@ -58,12 +58,7 @@ class NoInternetActivity : BaseActivity() {
|
|||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
|
|
||||||
if (intent.getBooleanExtra(IntentData.openAudioPlayer, false)) {
|
if (intent.getBooleanExtra(IntentData.openAudioPlayer, false)) {
|
||||||
// attempt to recycle already existing audio player fragment first before creating new one
|
NavigationHelper.startAudioPlayer(this, offlinePlayer = true)
|
||||||
supportFragmentManager.fragments.filterIsInstance<AudioPlayerFragment>().firstOrNull()?.let {
|
|
||||||
it.binding.playerMotionLayout.transitionToStart()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
NavigationHelper.startAudioPlayer(this)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,6 +298,8 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
|
|||||||
* Load the information from a new stream into the UI
|
* Load the information from a new stream into the UI
|
||||||
*/
|
*/
|
||||||
private fun updateStreamInfo(stream: StreamItem? = null) {
|
private fun updateStreamInfo(stream: StreamItem? = null) {
|
||||||
|
val binding = _binding ?: return
|
||||||
|
|
||||||
val current = stream ?: PlayingQueue.getCurrent() ?: return
|
val current = stream ?: PlayingQueue.getCurrent() ?: return
|
||||||
|
|
||||||
binding.title.text = current.title
|
binding.title.text = current.title
|
||||||
@ -380,6 +382,8 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
|
|||||||
|
|
||||||
private fun updatePlayPauseButton() {
|
private fun updatePlayPauseButton() {
|
||||||
playerService?.player?.let {
|
playerService?.player?.let {
|
||||||
|
val binding = _binding ?: return
|
||||||
|
|
||||||
val iconRes = PlayerHelper.getPlayPauseActionIcon(it)
|
val iconRes = PlayerHelper.getPlayPauseActionIcon(it)
|
||||||
binding.playPause.setIconResource(iconRes)
|
binding.playPause.setIconResource(iconRes)
|
||||||
binding.miniPlayerPause.setImageResource(iconRes)
|
binding.miniPlayerPause.setImageResource(iconRes)
|
||||||
|
Loading…
Reference in New Issue
Block a user