Rename callback and allow it to be set externally
This commit is contained in:
parent
5ab2bc2fe7
commit
467058583b
3 changed files with 9 additions and 6 deletions
|
@ -114,7 +114,7 @@ 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)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
|
|
@ -87,9 +87,10 @@ 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 = MediaSideScroll(activity!!, view.slide_info)
|
||||
mediaSideScroll.onClickOnSlider = {
|
||||
view.video_holder.performClick()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
|
@ -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, val onSpecialEvent: () -> Unit) {
|
||||
class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) {
|
||||
private val CLICK_MAX_DURATION = 150
|
||||
private val SLIDE_INFO_FADE_DELAY = 1000L
|
||||
private var mTouchDownX = 0f
|
||||
|
@ -24,6 +24,8 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o
|
|||
private var mSlideInfoText = ""
|
||||
private var mSlideInfoFadeHandler = Handler()
|
||||
|
||||
var onClickOnSlider: (() -> Unit)? = null
|
||||
|
||||
fun handleVolumeTouched(event: MotionEvent) {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
|
@ -55,7 +57,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o
|
|||
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) {
|
||||
onSpecialEvent()
|
||||
onClickOnSlider?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +95,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o
|
|||
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) {
|
||||
onSpecialEvent()
|
||||
onClickOnSlider?.invoke()
|
||||
}
|
||||
mTouchDownBrightness = mTempBrightness
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue