From 9877cbaf2cde09f190f4ee15a9f51f1973d091d9 Mon Sep 17 00:00:00 2001 From: ForgottenUmbrella Date: Mon, 27 Jan 2020 02:13:25 +1100 Subject: [PATCH] Remove unreachable branches in video completion handling It is never the case that `loopVideos == true` in the `videoCompleted` handler, since enabling that preference sets `repeatMode`, which in turn prevents the player from reaching `STATE_ENDED`. Thus, the branches are unreachable. --- .../gallery/pro/activities/VideoPlayerActivity.kt | 10 +++------- .../gallery/pro/fragments/VideoFragment.kt | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 6b306ba4c..27839af11 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -347,13 +347,9 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen clearLastVideoSavedProgress() mCurrTime = (mExoPlayer!!.duration / 1000).toInt() - if (config.loopVideos) { - resumeVideo() - } else { - video_seekbar.progress = video_seekbar.max - video_curr_time.text = mDuration.getFormattedDuration() - pauseVideo() - } + video_seekbar.progress = video_seekbar.max + video_curr_time.text = mDuration.getFormattedDuration() + pauseVideo() } private fun didVideoEnd(): Boolean { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 56deff9a1..bc7a69b56 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -681,13 +681,9 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mCurrTime = (mExoPlayer!!.duration / 1000).toInt() - if (listener?.videoEnded() == false && mConfig.loopVideos) { - playVideo() - } else { - mSeekBar.progress = mSeekBar.max - mCurrTimeView.text = mDuration.getFormattedDuration() - pauseVideo() - } + mSeekBar.progress = mSeekBar.max + mCurrTimeView.text = mDuration.getFormattedDuration() + pauseVideo() } private fun cleanup() {