fix: pip zoom start player maximized (#640)
* fix zoom * update isZoomEnabled inside updateZoomMode To avoid future issues, I will update `isZoomEnabled` inside `updateZoomMode`. * Revert " update isZoomEnabled inside updateZoomMode" This reverts commit 9b539e1830bc76db0c540a51299f05a09c553d00. * fix: isZoomEnable * val enableZoom for readability * lint
This commit is contained in:
parent
6051fee681
commit
3ba5a73c74
2 changed files with 6 additions and 3 deletions
|
@ -55,6 +55,7 @@ class PlayerActivity : BasePlayerActivity() {
|
|||
private var playerGestureHelper: PlayerGestureHelper? = null
|
||||
override val viewModel: PlayerActivityViewModel by viewModels()
|
||||
private var previewScrubListener: PreviewScrubListener? = null
|
||||
private var wasZoom: Boolean = false
|
||||
|
||||
private val isPipSupported by lazy {
|
||||
// Check if device has PiP feature
|
||||
|
@ -308,6 +309,7 @@ class PlayerActivity : BasePlayerActivity() {
|
|||
binding.playerView.useController = false
|
||||
binding.playerView.findViewById<Button>(R.id.btn_skip_intro).isVisible = false
|
||||
|
||||
wasZoom = playerGestureHelper!!.isZoomEnabled
|
||||
playerGestureHelper?.updateZoomMode(false)
|
||||
|
||||
// Brightness mode Auto
|
||||
|
@ -327,7 +329,7 @@ class PlayerActivity : BasePlayerActivity() {
|
|||
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
|
||||
if (!isInPictureInPictureMode) {
|
||||
binding.playerView.useController = true
|
||||
playerGestureHelper?.isZoomEnabled?.let { playerGestureHelper!!.updateZoomMode(it) }
|
||||
playerGestureHelper?.updateZoomMode(wasZoom)
|
||||
|
||||
// Override auto brightness
|
||||
window.attributes = window.attributes.apply {
|
||||
|
|
|
@ -330,8 +330,8 @@ class PlayerGestureHelper(
|
|||
lastScaleEvent = SystemClock.elapsedRealtime()
|
||||
val scaleFactor = detector.scaleFactor
|
||||
if (abs(scaleFactor - Constants.ZOOM_SCALE_BASE) > Constants.ZOOM_SCALE_THRESHOLD) {
|
||||
isZoomEnabled = scaleFactor > 1
|
||||
updateZoomMode(isZoomEnabled)
|
||||
val enableZoom = scaleFactor > 1
|
||||
updateZoomMode(enableZoom)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -346,6 +346,7 @@ class PlayerGestureHelper(
|
|||
} else {
|
||||
playerView.resizeMode = if (enabled) AspectRatioFrameLayout.RESIZE_MODE_ZOOM else AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||
}
|
||||
isZoomEnabled = enabled
|
||||
}
|
||||
|
||||
private fun releaseAction(event: MotionEvent) {
|
||||
|
|
Loading…
Reference in a new issue