mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
removing some more scaling related redundant code
This commit is contained in:
parent
7e7ef2063e
commit
e9cbf444e1
3 changed files with 12 additions and 42 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue