wteak the MediaSideScroll callback a bit
This commit is contained in:
parent
42faaf51c1
commit
605cf6ae0f
3 changed files with 13 additions and 8 deletions
|
@ -114,7 +114,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mediaSideScroll = MediaSideScroll(activity!!, view.slide_info)
|
||||
mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) {
|
||||
view.apply {
|
||||
if (subsampling_view.isVisible()) {
|
||||
subsampling_view.performClick()
|
||||
} else {
|
||||
gif_view.performClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
|
|
@ -87,8 +87,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mediaSideScroll = MediaSideScroll(activity!!, view.slide_info)
|
||||
mediaSideScroll.onClickOnSlider = {
|
||||
mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) {
|
||||
view.video_holder.performClick()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.simplemobiletools.gallery.R
|
|||
import com.simplemobiletools.gallery.activities.ViewPagerActivity
|
||||
import com.simplemobiletools.gallery.extensions.audioManager
|
||||
|
||||
class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) {
|
||||
class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val callback: () -> Unit) {
|
||||
private val CLICK_MAX_DURATION = 150
|
||||
private val SLIDE_INFO_FADE_DELAY = 1000L
|
||||
private var mTouchDownX = 0f
|
||||
|
@ -24,8 +24,6 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) {
|
|||
private var mSlideInfoText = ""
|
||||
private var mSlideInfoFadeHandler = Handler()
|
||||
|
||||
var onClickOnSlider: (() -> Unit)? = null
|
||||
|
||||
fun handleVolumeTouched(event: MotionEvent) {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
|
@ -57,7 +55,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) {
|
|||
val diffX = Math.abs(event.x - mTouchDownX)
|
||||
val diffY = Math.abs(event.y - mTouchDownY)
|
||||
if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) {
|
||||
onClickOnSlider?.invoke()
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +93,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) {
|
|||
val diffX = Math.abs(event.x - mTouchDownX)
|
||||
val diffY = Math.abs(event.y - mTouchDownY)
|
||||
if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) {
|
||||
onClickOnSlider?.invoke()
|
||||
callback()
|
||||
}
|
||||
mTouchDownBrightness = mTempBrightness
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue