mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 14:28:00 +01:00
adding a double tap listener at the volume/brightness controllers
This commit is contained in:
parent
c7bc916784
commit
0d7aa81442
4 changed files with 24 additions and 14 deletions
|
@ -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()
|
||||
|
|
|
@ -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 ->
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue