Added stop all gestures flow.

This commit is contained in:
Koen 2023-12-07 17:16:25 +01:00
parent a15e4beafb
commit e4d39cbec4
5 changed files with 30 additions and 2 deletions

View file

@ -216,6 +216,7 @@ class VideoDetailFragment : MainFragment {
}
_view!!.setTransitionListener(object : MotionLayout.TransitionListener {
override fun onTransitionChange(motionLayout: MotionLayout?, startId: Int, endId: Int, progress: Float) {
_viewDetail?.stopAllGestures()
if (state != State.MINIMIZED && progress < 0.1) {
state = State.MINIMIZED;

View file

@ -683,6 +683,11 @@ class VideoDetailView : ConstraintLayout {
}
}
fun stopAllGestures() {
_player.stopAllGestures();
_cast.stopAllGestures();
}
fun updateMoreButtons() {
val buttons = listOf(RoundButton(context, R.drawable.ic_add, context.getString(R.string.add), TAG_ADD) {
(video ?: _searchVideo)?.let {
@ -1941,6 +1946,7 @@ class VideoDetailView : ConstraintLayout {
video?.let { updateQualitySourcesOverlay(it, videoLocal); };
val changed = _isCasting != isCasting;
_isCasting = isCasting;
if(isCasting) {
@ -1948,8 +1954,7 @@ class VideoDetailView : ConstraintLayout {
_player.stop();
_player.hideControls(false);
_cast.visibility = View.VISIBLE;
}
else {
} else {
StateCasting.instance.stopVideo();
_cast.stopTimeJob();
_cast.visibility = View.GONE;
@ -1958,6 +1963,10 @@ class VideoDetailView : ConstraintLayout {
_player.setPlaybackRate(Settings.instance.playback.getDefaultPlaybackSpeed());
}
}
if (changed) {
stopAllGestures();
}
}
fun setFullscreen(fullscreen : Boolean) {

View file

@ -330,11 +330,21 @@ class GestureControlView : LinearLayout {
_controlsVisible = false;
}
fun stopAllGestures() {
stopAdjustingFullscreenDown()
stopAdjustingBrightness()
stopAdjustingSound()
stopAdjustingFullscreenUp()
stopFastForward()
stopAutoFastForward()
}
fun cleanup() {
_jobExitFastForward?.cancel();
_jobExitFastForward = null;
_jobAutoFastForward?.cancel();
_jobAutoFastForward = null;
stopAllGestures();
cancelHideJob();
_scope.cancel();
}

View file

@ -102,6 +102,10 @@ class CastView : ConstraintLayout {
_updateTimeJob = null;
}
fun stopAllGestures() {
_gestureControlView.stopAllGestures();
}
fun setIsPlaying(isPlaying: Boolean) {
_updateTimeJob?.cancel();

View file

@ -343,6 +343,10 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
_currentChapterLoopActive = false;
}
fun stopAllGestures() {
gestureControl.stopAllGestures();
}
fun attachPlayer() {
exoPlayer?.attach(_videoView, PLAYER_STATE_NAME);
}