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 -> {
|
MotionEvent.ACTION_UP -> {
|
||||||
val diffX = mTouchDownX - event.x
|
|
||||||
val diffY = mTouchDownY - event.y
|
|
||||||
|
|
||||||
mIgnoreCloseDown = false
|
mIgnoreCloseDown = false
|
||||||
if (mIsDragged) {
|
if (mIsDragged) {
|
||||||
if (mIsFullscreen) {
|
if (mIsFullscreen) {
|
||||||
|
@ -816,21 +813,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
mMatrix.getValues(mMatrices)
|
mMatrix.getValues(mMatrices)
|
||||||
val x = mMatrices[Matrix.MTRANS_X]
|
|
||||||
val y = mMatrices[Matrix.MTRANS_Y]
|
val y = mMatrices[Matrix.MTRANS_Y]
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
if (width > 0) {
|
if (y < -mBottom) {
|
||||||
if (y < -mBottom) {
|
mMatrix.postTranslate(0f, -(y + mBottom))
|
||||||
mMatrix.postTranslate(0f, -(y + mBottom))
|
} else if (y > 0) {
|
||||||
} else if (y > 0) {
|
mMatrix.postTranslate(0f, -y)
|
||||||
mMatrix.postTranslate(0f, -y)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x < -mRight) {
|
|
||||||
mMatrix.postTranslate(-(x + mRight), 0f)
|
|
||||||
} else if (x > 0) {
|
|
||||||
mMatrix.postTranslate(-x, 0f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,21 +800,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
||||||
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
mMatrix.getValues(mMatrices)
|
mMatrix.getValues(mMatrices)
|
||||||
val x = mMatrices[Matrix.MTRANS_X]
|
|
||||||
val y = mMatrices[Matrix.MTRANS_Y]
|
val y = mMatrices[Matrix.MTRANS_Y]
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
if (width > 0) {
|
if (y < -mBottom) {
|
||||||
if (y < -mBottom) {
|
mMatrix.postTranslate(0f, -(y + mBottom))
|
||||||
mMatrix.postTranslate(0f, -(y + mBottom))
|
} else if (y > 0) {
|
||||||
} else if (y > 0) {
|
mMatrix.postTranslate(0f, -y)
|
||||||
mMatrix.postTranslate(0f, -y)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x < -mRight) {
|
|
||||||
mMatrix.postTranslate(-(x + mRight), 0f)
|
|
||||||
} else if (x > 0) {
|
|
||||||
mMatrix.postTranslate(-x, 0f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,21 +155,12 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu
|
||||||
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY)
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
mMatrix.getValues(mMatrices)
|
mMatrix.getValues(mMatrices)
|
||||||
val x = mMatrices[Matrix.MTRANS_X]
|
|
||||||
val y = mMatrices[Matrix.MTRANS_Y]
|
val y = mMatrices[Matrix.MTRANS_Y]
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
if (width > 0) {
|
if (y < -mBottom) {
|
||||||
if (y < -mBottom) {
|
mMatrix.postTranslate(0f, -(y + mBottom))
|
||||||
mMatrix.postTranslate(0f, -(y + mBottom))
|
} else if (y > 0) {
|
||||||
} else if (y > 0) {
|
mMatrix.postTranslate(0f, -y)
|
||||||
mMatrix.postTranslate(0f, -y)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x < -mRight) {
|
|
||||||
mMatrix.postTranslate(-(x + mRight), 0f)
|
|
||||||
} else if (x > 0) {
|
|
||||||
mMatrix.postTranslate(-x, 0f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue