mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +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
|
||||
val aspectRatioModes = arrayOf(
|
||||
AspectRatioFrameLayout.RESIZE_MODE_FIT,
|
||||
AspectRatioFrameLayout.RESIZE_MODE_ZOOM,
|
||||
AspectRatioFrameLayout.RESIZE_MODE_FILL
|
||||
)
|
||||
playerBinding.aspectRatioButton.setOnClickListener {
|
||||
val isZoomed = exoPlayerView.resizeMode != AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||
if (isZoomed) {
|
||||
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||
} else {
|
||||
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
||||
}
|
||||
val index = aspectRatioModes.indexOf(exoPlayerView.resizeMode)
|
||||
val newAspectRatioMode =
|
||||
if (index + 1 < aspectRatioModes.size) aspectRatioModes[index + 1]
|
||||
else aspectRatioModes[0]
|
||||
exoPlayerView.resizeMode = newAspectRatioMode
|
||||
}
|
||||
|
||||
// lock and unlock the player
|
||||
|
Loading…
Reference in New Issue
Block a user