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 f019fef43..66d82dddb 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 @@ -544,15 +544,15 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen private fun handleEvent(event: MotionEvent) { when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y + mTouchDownX = event.rawX + mTouchDownY = event.rawY mTouchDownTime = System.currentTimeMillis() mProgressAtDown = mExoPlayer!!.currentPosition } MotionEvent.ACTION_POINTER_DOWN -> mIgnoreCloseDown = true MotionEvent.ACTION_MOVE -> { - val diffX = event.x - mTouchDownX - val diffY = event.y - mTouchDownY + val diffX = event.rawX - mTouchDownX + val diffY = event.rawY - mTouchDownY if (mIsDragged || (Math.abs(diffX) > mDragThreshold && Math.abs(diffX) > Math.abs(diffY)) && video_surface_frame.controller.state.zoom == 1f) { if (!mIsDragged) { @@ -574,8 +574,8 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } } MotionEvent.ACTION_UP -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y + val diffX = mTouchDownX - event.rawX + val diffY = mTouchDownY - event.rawY val downGestureDuration = System.currentTimeMillis() - mTouchDownTime if (config.allowDownGesture && !mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt index 99208403c..443346832 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt @@ -136,16 +136,16 @@ abstract class ViewPagerFragment : Fragment() { when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { mTouchDownTime = System.currentTimeMillis() - mTouchDownX = event.x - mTouchDownY = event.y + mTouchDownX = event.rawX + mTouchDownY = event.rawY } MotionEvent.ACTION_POINTER_DOWN -> mIgnoreCloseDown = true MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y + val diffX = mTouchDownX - event.rawX + val diffY = mTouchDownY - event.rawY val downGestureDuration = System.currentTimeMillis() - mTouchDownTime - if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && context?.config?.allowDownGesture == true) { + if (!mIgnoreCloseDown && (Math.abs(diffY) > Math.abs(diffX)) && (diffY < -mCloseDownThreshold) && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && context?.config?.allowDownGesture == true) { activity?.finish() activity?.overridePendingTransition(0, R.anim.slide_down) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 2220ef840..f9187cb20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -55,8 +55,8 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at } override fun onTouchEvent(event: MotionEvent): Boolean { - val x = event.x - val y = event.y + val x = event.rawX + val y = event.rawY when (event.action and MotionEvent.ACTION_MASK) { MotionEvent.ACTION_DOWN -> { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt index 18f2f154e..8663b177f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt @@ -36,13 +36,13 @@ class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout( when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y + mTouchDownX = event.rawX + mTouchDownY = event.rawY mTouchDownTime = System.currentTimeMillis() } MotionEvent.ACTION_UP -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y + val diffX = mTouchDownX - event.rawX + val diffY = mTouchDownY - event.rawY if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { performClick() } @@ -52,12 +52,12 @@ class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout( return false } - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y + val diffX = mTouchDownX - event.rawX + val diffY = mTouchDownY - event.rawY if (Math.abs(diffX) > dragThreshold || Math.abs(diffY) > dragThreshold) { if (!passTouches) { event.action = MotionEvent.ACTION_DOWN - event.setLocation(event.rawX, event.y) + event.setLocation(event.rawX, event.rawY) parentView?.dispatchTouchEvent(event) } passTouches = true 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 7224cf990..90ed9ee21 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 @@ -87,9 +87,9 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co gestureDetector.onTouchEvent(event) when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y - mLastTouchY = event.y + mTouchDownX = event.rawX + mTouchDownY = event.rawY + mLastTouchY = event.rawY mTouchDownTime = System.currentTimeMillis() if (mIsBrightnessScroll) { if (mTouchDownValue == -1) { @@ -100,15 +100,15 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } } MotionEvent.ACTION_MOVE -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y + val diffX = mTouchDownX - event.rawX + val diffY = mTouchDownY - event.rawY if (Math.abs(diffY) > dragThreshold && Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / mViewHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) - if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { - mTouchDownY = event.y + if ((percent == 100 && event.rawY > mLastTouchY) || (percent == -100 && event.rawY < mLastTouchY)) { + mTouchDownY = event.rawY mTouchDownValue = if (mIsBrightnessScroll) mTempBrightness else getCurrentVolume() } @@ -116,14 +116,14 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } else if (Math.abs(diffX) > dragThreshold || Math.abs(diffY) > dragThreshold) { if (!mPassTouches) { event.action = MotionEvent.ACTION_DOWN - event.setLocation(event.rawX, event.y) + event.setLocation(event.rawX, event.rawY) mParentView?.dispatchTouchEvent(event) } mPassTouches = true mParentView?.dispatchTouchEvent(event) return false } - mLastTouchY = event.y + mLastTouchY = event.rawY } MotionEvent.ACTION_UP -> { if (mIsBrightnessScroll) {