fix rwd/ffwd button pos when animation is running, clean up rwd/ffwd animation handling

This commit is contained in:
2022-07-10 12:52:42 +02:00
parent 9059306e90
commit c34b95795f
2 changed files with 7 additions and 77 deletions

View File

@ -229,7 +229,11 @@ class PlayerActivity : AppCompatActivity() {
else -> View.GONE
}
controlsBinding.exoPlayPause.isVisible = !playerBinding.loading.isVisible
// don't use isVisible to hide exoPlayPause, as it will set the visibility to GONE
controlsBinding.exoPlayPause.visibility = when(playerBinding.loading.isVisible) {
true -> View.INVISIBLE
false -> View.VISIBLE
}
if (state == ExoPlayer.STATE_ENDED && hasNextEpisode() && Preferences.autoplay) {
playNextEpisode()
@ -383,44 +387,14 @@ class PlayerActivity : AppCompatActivity() {
return (model.currentEpisode.nextEpisodeId != null && !model.currentEpisodeIsLastEpisode())
}
/**
* TODO set position of rewind/fast forward indicators programmatically
*/
private fun rewind() {
model.seekToOffset(rwdTime)
// hide/show needed components
playerBinding.exoDoubleTapIndicator.visibility = View.VISIBLE
playerBinding.ffwd10Indicator.visibility = View.INVISIBLE
controlsBinding.rwd10.visibility = View.INVISIBLE
playerBinding.rwd10Indicator.onAnimationEndCallback = {
playerBinding.exoDoubleTapIndicator.visibility = View.GONE
playerBinding.ffwd10Indicator.visibility = View.VISIBLE
controlsBinding.rwd10.visibility = View.VISIBLE
}
// run animation
playerBinding.rwd10Indicator.runOnClickAnimation()
controlsBinding.rwd10.runOnClickAnimation()
}
private fun fastForward() {
model.seekToOffset(fwdTime)
// hide/show needed components
playerBinding.exoDoubleTapIndicator.visibility = View.VISIBLE
playerBinding.rwd10Indicator.visibility = View.INVISIBLE
controlsBinding.ffwd10.visibility = View.INVISIBLE
playerBinding.ffwd10Indicator.onAnimationEndCallback = {
playerBinding.exoDoubleTapIndicator.visibility = View.GONE
playerBinding.rwd10Indicator.visibility = View.VISIBLE
controlsBinding.ffwd10.visibility = View.VISIBLE
}
// run animation
playerBinding.ffwd10Indicator.runOnClickAnimation()
controlsBinding.ffwd10.runOnClickAnimation()
}
private fun playNextEpisode() {