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

This commit is contained in:
Jannik 2022-07-10 12:52:42 +02:00
parent 9059306e90
commit c34b95795f
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
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() {

View File

@ -27,50 +27,6 @@
app:indicatorColor="@color/player_white"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/exo_double_tap_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.RewindButton
android:id="@+id/rwd_10_indicator"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<Space
android:layout_width="60dp"
android:layout_height="1dp" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<org.mosad.teapod.ui.components.FastForwardButton
android:id="@+id/ffwd_10_indicator"
android:layout_width="100dp"
android:layout_height="wrap_content" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/button_next_ep"
android:layout_width="wrap_content"