mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #2263 from Kruna1Pate1/fix/caption-position
Fix subtitles cropped in zoom mode
This commit is contained in:
commit
ce7054619f
@ -33,6 +33,7 @@ import com.google.android.exoplayer2.Player
|
|||||||
import com.google.android.exoplayer2.trackselection.TrackSelector
|
import com.google.android.exoplayer2.trackselection.TrackSelector
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
||||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||||
|
import com.google.android.exoplayer2.ui.SubtitleView
|
||||||
import com.google.android.exoplayer2.util.RepeatModeUtil
|
import com.google.android.exoplayer2.util.RepeatModeUtil
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@ -552,20 +553,33 @@ internal class CustomExoPlayerView(
|
|||||||
override fun onZoom() {
|
override fun onZoom() {
|
||||||
if (!PlayerHelper.pinchGestureEnabled) return
|
if (!PlayerHelper.pinchGestureEnabled) return
|
||||||
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
||||||
|
|
||||||
|
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
subtitleView?.setBottomPaddingFraction(SUBTITLE_BOTTOM_PADDING_FRACTION)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMinimize() {
|
override fun onMinimize() {
|
||||||
if (!PlayerHelper.pinchGestureEnabled) return
|
if (!PlayerHelper.pinchGestureEnabled) return
|
||||||
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
|
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||||
|
subtitleView?.setBottomPaddingFraction(SubtitleView.DEFAULT_BOTTOM_PADDING_FRACTION)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFullscreenChange(isFullscreen: Boolean) {
|
override fun onFullscreenChange(isFullscreen: Boolean) {
|
||||||
if (PlayerHelper.swipeGestureEnabled && this::brightnessHelper.isInitialized) {
|
if (PlayerHelper.swipeGestureEnabled && this::brightnessHelper.isInitialized) {
|
||||||
if (isFullscreen) {
|
if (isFullscreen) {
|
||||||
brightnessHelper.restoreSavedBrightness()
|
brightnessHelper.restoreSavedBrightness()
|
||||||
|
if (resizeMode == AspectRatioFrameLayout.RESIZE_MODE_ZOOM) {
|
||||||
|
subtitleView?.setBottomPaddingFraction(SUBTITLE_BOTTOM_PADDING_FRACTION)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
brightnessHelper.resetToSystemBrightness(false)
|
brightnessHelper.resetToSystemBrightness(false)
|
||||||
|
subtitleView?.setBottomPaddingFraction(SubtitleView.DEFAULT_BOTTOM_PADDING_FRACTION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user