Use constant for subtitle padding fraction

This commit is contained in:
Krunal Patel 2022-12-06 14:20:56 +05:30
parent 769d09f98d
commit 5457494340

View File

@ -514,7 +514,7 @@ internal class CustomExoPlayerView(
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
subtitleView?.setBottomPaddingFraction(0.158f) subtitleView?.setBottomPaddingFraction(SUBTITLE_BOTTOM_PADDING_FRACTION)
} }
} }
@ -529,7 +529,7 @@ internal class CustomExoPlayerView(
if (isFullscreen) { if (isFullscreen) {
brightnessHelper.restoreSavedBrightness() brightnessHelper.restoreSavedBrightness()
if (resizeMode == AspectRatioFrameLayout.RESIZE_MODE_ZOOM) { if (resizeMode == AspectRatioFrameLayout.RESIZE_MODE_ZOOM) {
subtitleView?.setBottomPaddingFraction(0.158f) subtitleView?.setBottomPaddingFraction(SUBTITLE_BOTTOM_PADDING_FRACTION)
} }
} else { } else {
brightnessHelper.resetToSystemBrightness(false) brightnessHelper.resetToSystemBrightness(false)
@ -537,4 +537,8 @@ internal class CustomExoPlayerView(
} }
} }
} }
companion object {
private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f
}
} }