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 5e506f966..01daa6fbc 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 @@ -196,13 +196,13 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen video_surface.surfaceTextureListener = this if (config.allowVideoGestures) { - video_brightness_controller.initialize(this, slide_info, true, video_player_holder) { x, y -> + video_brightness_controller.initialize(this, slide_info, true, video_player_holder, singleTap = { x, y -> toggleFullscreen() - } + }) - video_volume_controller.initialize(this, slide_info, false, video_player_holder) { x, y -> + video_volume_controller.initialize(this, slide_info, false, video_player_holder, singleTap = { x, y -> toggleFullscreen() - } + }) } else { video_brightness_controller.beGone() video_volume_controller.beGone() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 8b0934274..6f7064d55 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -111,7 +111,7 @@ class PhotoFragment : ViewPagerFragment() { instant_prev_item.parentView = container instant_next_item.parentView = container - photo_brightness_controller.initialize(activity!!, slide_info, true, container) { x, y -> + photo_brightness_controller.initialize(activity!!, slide_info, true, container, singleTap = { x, y -> mView.apply { if (subsampling_view.isVisible()) { subsampling_view.sendFakeClick(x, y) @@ -119,7 +119,7 @@ class PhotoFragment : ViewPagerFragment() { gestures_view.sendFakeClick(x, y) } } - } + }) if (context.config.allowDownGesture) { gif_view.setOnTouchListener { v, event -> 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 c89e3cf0b..63fb3688f 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 @@ -205,21 +205,21 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S setVideoSize() mView.apply { - mBrightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y -> + mBrightnessSideScroll.initialize(activity!!, slide_info, true, container, singleTap = { x, y -> if (mConfig.allowInstantChange) { listener?.goToPrevItem() } else { toggleFullscreen() } - } + }) - mVolumeSideScroll.initialize(activity!!, slide_info, false, container) { x, y -> + mVolumeSideScroll.initialize(activity!!, slide_info, false, container, singleTap = { x, y -> if (mConfig.allowInstantChange) { listener?.goToNextItem() } else { toggleFullscreen() } - } + }) video_surface.onGlobalLayout { if (mIsFragmentVisible && mConfig.autoplayVideos && !mConfig.openVideosOnSeparateScreen) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt index e21fce85b..61ff895a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt @@ -34,14 +34,17 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private var mSlideInfoFadeHandler = Handler() private var mParentView: ViewGroup? = null private var activity: Activity? = null + private var doubleTap: ((Float, Float) -> Unit)? = null private lateinit var slideInfoView: TextView - private lateinit var callback: (Float, Float) -> Unit + private lateinit var singleTap: (Float, Float) -> Unit - fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, callback: (x: Float, y: Float) -> Unit) { + fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, singleTap: (x: Float, y: Float) -> Unit, + doubleTap: ((x: Float, y: Float) -> Unit)? = null) { this.activity = activity this.slideInfoView = slideInfoView - this.callback = callback + this.singleTap = singleTap + this.doubleTap = doubleTap mParentView = parentView mIsBrightnessScroll = isBrightness mSlideInfoText = activity.getString(if (isBrightness) R.string.brightness else R.string.volume) @@ -53,7 +56,14 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private val gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { override fun onSingleTapConfirmed(e: MotionEvent?): Boolean { if (e != null) { - callback(e.rawX, e.rawY) + singleTap(e.rawX, e.rawY) + } + return true + } + + override fun onDoubleTap(e: MotionEvent?): Boolean { + if (e != null && doubleTap != null) { + doubleTap!!.invoke(e.rawX, e.rawY) } return true }