Skip to content
Snippets Groups Projects
Commit 4d3acdb5 authored by Kai DeLorenzo's avatar Kai DeLorenzo :purple_heart:
Browse files

Merge branch 'landscape-fixes' into 'master'

Fix black bars on top and bottom of videos

See merge request !49
parents da27517f ca9e321e
No related branches found
No related tags found
1 merge request!49Fix black bars on top and bottom of videos
......@@ -750,12 +750,12 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
if (_lastSourceFit == null || windowWidth != _lastWindowWidth || windowHeight != _lastWindowHeight) {
val maxHeight = windowHeight * 0.4f
val minHeight = windowHeight * 0.1f
val aspectRatio = h.toFloat() / w
val determinedHeight = (aspectRatio * windowWidth)
val determinedHeight = windowWidth / w.toFloat() * h.toFloat()
_lastSourceFit = determinedHeight
_lastSourceFit = _lastSourceFit!!.coerceAtLeast(220f)
_lastSourceFit = _lastSourceFit!!.coerceAtLeast(minHeight)
_lastSourceFit = _lastSourceFit!!.coerceAtMost(maxHeight)
_desiredResizeModePortrait = if (_lastSourceFit != determinedHeight)
......@@ -770,14 +770,13 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
val marginBottom =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 7f, resources.displayMetrics)
.toInt()
val height = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
_lastSourceFit!!,
resources.displayMetrics
)
val rootParams = LayoutParams(LayoutParams.MATCH_PARENT, (height + marginBottom).toInt())
rootParams.bottomMargin = marginBottom
rootParams.bottomMargin = marginBottom.toInt()
_root.layoutParams = rootParams
isFitMode = true
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment