From ada0661d893406a570e2be18930fe7f4932d24c2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Mar 2020 10:19:31 +0100 Subject: [PATCH] fix video gestures when Gesture Down To Close is disabled --- .../gallery/pro/fragments/VideoFragment.kt | 21 ++++++++----------- .../pro/fragments/ViewPagerFragment.kt | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) 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 e2f3c6ecb..3d663ec8b 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 @@ -140,21 +140,18 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } }) - if (mConfig.allowDownGesture) { - video_preview.setOnTouchListener { view, event -> + video_preview.setOnTouchListener { view, event -> + handleEvent(event) + false + } + + video_surface_frame.setOnTouchListener { view, event -> + if (video_surface_frame.controller.state.zoom == 1f) { handleEvent(event) - false - } - - video_surface_frame.setOnTouchListener { view, event -> - if (video_surface_frame.controller.state.zoom == 1f) { - handleEvent(event) - } - - gestureDetector.onTouchEvent(event) - false } + gestureDetector.onTouchEvent(event) + false } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt index 7473326dd..ef017dbad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt @@ -140,7 +140,7 @@ abstract class ViewPagerFragment : Fragment() { val diffY = mTouchDownY - event.y val downGestureDuration = System.currentTimeMillis() - mTouchDownTime - if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { + if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && context?.config?.allowDownGesture == true) { activity?.supportFinishAfterTransition() } mIgnoreCloseDown = false