fix rwd/ffwd button pos when animation is running, clean up rwd/ffwd animation handling
This commit is contained in:
		| @ -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() { | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user