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 { _view!!.setTransitionListener(object : MotionLayout.TransitionListener {
override fun onTransitionChange(motionLayout: MotionLayout?, startId: Int, endId: Int, progress: Float) { override fun onTransitionChange(motionLayout: MotionLayout?, startId: Int, endId: Int, progress: Float) {
_viewDetail?.stopAllGestures()
if (state != State.MINIMIZED && progress < 0.1) { if (state != State.MINIMIZED && progress < 0.1) {
state = State.MINIMIZED; state = State.MINIMIZED;

View File

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

View File

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

View File

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

View File

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