This commit is contained in:
Bnyro 2022-06-30 14:20:22 +02:00
parent 6d50edb6a5
commit 63c97508de

View File

@ -1,34 +0,0 @@
package com.github.libretube.util
import android.util.Log
import android.view.ScaleGestureDetector
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
import com.google.android.exoplayer2.ui.StyledPlayerView
class CustomOnScaleGestureListener(
private val player: StyledPlayerView
) : ScaleGestureDetector.SimpleOnScaleGestureListener() {
private var scaleFactor = 0f
override fun onScale(
detector: ScaleGestureDetector
): Boolean {
scaleFactor = detector.scaleFactor
return true
}
override fun onScaleBegin(
detector: ScaleGestureDetector
): Boolean {
return true
}
override fun onScaleEnd(detector: ScaleGestureDetector) {
Log.e("scale", "scale")
if (scaleFactor > 1) {
player.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
} else {
player.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
}
}
}