improve buttonNextEp hiding behaviour

* the button will be diabled on PlayerActivity.playNextEpisode()
* the button will only be enabled if PlayerViewModel.playNextEpisode() returns
* remainingTime will be set to 0, if duration < 0, this fixes the button reapring after a few 100 ms when beeing pressed

fixes #53
This commit is contained in:
Jannik 2022-08-27 13:59:30 +02:00
parent f128efea0d
commit 85b17d7a76
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
1 changed files with 11 additions and 1 deletions

View File

@ -302,6 +302,8 @@ class PlayerActivity : AppCompatActivity() {
if (model.player.duration > 0) {
remainingTime = model.player.duration - currentPosition
remainingTime = if (remainingTime < 0) 0 else remainingTime
} else {
remainingTime = 0
}
// TODO add metaDB ending_start support
@ -428,8 +430,16 @@ class PlayerActivity : AppCompatActivity() {
}
private fun playNextEpisode() {
model.playNextEpisode()
// disable the next episode buttons, so a user can't double click it
playerBinding.buttonNextEp.isClickable = false
controlsBinding.buttonNextEpC.isClickable = false
hideButtonNextEp()
model.playNextEpisode()
// enable the next episode buttons when playNextEpisode() has returned
playerBinding.buttonNextEp.isClickable = true
controlsBinding.buttonNextEpC.isClickable = true
}
private fun skipOpening() {