Fixed MusicSeekSkipTouchListener

This commit is contained in:
Prathamesh More 2022-05-26 19:42:07 +05:30
parent 87f1172481
commit b47029cb57

View file

@ -45,9 +45,9 @@ class MusicSeekSkipTouchListener(val activity: FragmentActivity, val next: Boole
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
val action = event?.actionMasked
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
if (action == MotionEvent.ACTION_UP) {
job?.cancel()
if (!wasSeeking) {
if (v?.isPressed == true && !wasSeeking) {
if (next) {
MusicPlayerRemote.playNextSong()
} else {
@ -55,6 +55,8 @@ class MusicSeekSkipTouchListener(val activity: FragmentActivity, val next: Boole
}
}
wasSeeking = false
} else if (action == MotionEvent.ACTION_CANCEL) {
job?.cancel()
}
return gestureDetector.onTouchEvent(event)
}