From e9cbf444e12d2ca2dd26a5e92090bf89cd9e285c Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 15 Jan 2019 16:21:45 +0100 Subject: [PATCH] removing some more scaling related redundant code --- .../pro/activities/VideoPlayerActivity.kt | 20 ++++--------------- .../gallery/pro/fragments/VideoFragment.kt | 17 ++++------------ .../pro/views/MyZoomableGifTextureView.kt | 17 ++++------------ 3 files changed, 12 insertions(+), 42 deletions(-) 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 1e73437b6..f09538ca1 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 @@ -761,9 +761,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } } MotionEvent.ACTION_UP -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y - mIgnoreCloseDown = false if (mIsDragged) { if (mIsFullscreen) { @@ -816,21 +813,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 96bddc49a..57ab7dcae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -800,21 +800,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index ec29309fe..59aec6067 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -155,21 +155,12 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } }