mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
Add a horizontal margin to the player controls at landscape
This commit is contained in:
parent
444bdd8583
commit
56f8fdf84f
@ -488,6 +488,7 @@ internal class CustomExoPlayerView(
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
|
||||
// add a larger bottom margin to the time bar in landscape mode
|
||||
val offset = when (newConfig?.orientation) {
|
||||
Configuration.ORIENTATION_LANDSCAPE -> 20.toPixel()
|
||||
else -> 10.toPixel()
|
||||
@ -498,6 +499,22 @@ internal class CustomExoPlayerView(
|
||||
params.bottomMargin = offset.toInt()
|
||||
it.layoutParams = params
|
||||
}
|
||||
|
||||
// add a margin to the top and the bottom bar in landscape mode for notches
|
||||
val newMargin = if (
|
||||
newConfig?.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
) {
|
||||
LANDSCAPE_MARGIN_HORIZONTAL
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
listOf(binding.exoTopBar, binding.exoBottomBar).forEach {
|
||||
val params = it.layoutParams as MarginLayoutParams
|
||||
params.marginStart = newMargin
|
||||
params.marginEnd = newMargin
|
||||
it.layoutParams = params
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSingleTap() {
|
||||
@ -576,5 +593,6 @@ internal class CustomExoPlayerView(
|
||||
|
||||
companion object {
|
||||
private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f
|
||||
private val LANDSCAPE_MARGIN_HORIZONTAL = (30).toPixel().toInt()
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,8 @@
|
||||
android:layout_gravity="top"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp">
|
||||
android:paddingHorizontal="5dp"
|
||||
android:paddingTop="5dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -41,8 +40,8 @@
|
||||
<ImageView
|
||||
android:id="@+id/lock_player"
|
||||
style="@style/PlayerControlTop"
|
||||
android:scaleX=".8"
|
||||
android:scaleY=".8"
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8"
|
||||
android:src="@drawable/ic_unlocked" />
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user