mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
add aspect ratio mode
This commit is contained in:
parent
00a1303180
commit
88aef190f9
@ -445,13 +445,17 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// switching between original aspect ratio (black bars) and zoomed to fill device screen
|
// switching between original aspect ratio (black bars) and zoomed to fill device screen
|
||||||
|
val aspectRatioModes = arrayOf(
|
||||||
|
AspectRatioFrameLayout.RESIZE_MODE_FIT,
|
||||||
|
AspectRatioFrameLayout.RESIZE_MODE_ZOOM,
|
||||||
|
AspectRatioFrameLayout.RESIZE_MODE_FILL
|
||||||
|
)
|
||||||
playerBinding.aspectRatioButton.setOnClickListener {
|
playerBinding.aspectRatioButton.setOnClickListener {
|
||||||
val isZoomed = exoPlayerView.resizeMode != AspectRatioFrameLayout.RESIZE_MODE_FIT
|
val index = aspectRatioModes.indexOf(exoPlayerView.resizeMode)
|
||||||
if (isZoomed) {
|
val newAspectRatioMode =
|
||||||
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
|
if (index + 1 < aspectRatioModes.size) aspectRatioModes[index + 1]
|
||||||
} else {
|
else aspectRatioModes[0]
|
||||||
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
exoPlayerView.resizeMode = newAspectRatioMode
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock and unlock the player
|
// lock and unlock the player
|
||||||
|
Loading…
Reference in New Issue
Block a user