mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #2570 from Bnyro/master
Add a horizontal margin to the player controls at landscape
This commit is contained in:
commit
8fba32adde
@ -488,6 +488,7 @@ internal class CustomExoPlayerView(
|
|||||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
|
|
||||||
|
// add a larger bottom margin to the time bar in landscape mode
|
||||||
val offset = when (newConfig?.orientation) {
|
val offset = when (newConfig?.orientation) {
|
||||||
Configuration.ORIENTATION_LANDSCAPE -> 20.toPixel()
|
Configuration.ORIENTATION_LANDSCAPE -> 20.toPixel()
|
||||||
else -> 10.toPixel()
|
else -> 10.toPixel()
|
||||||
@ -498,6 +499,22 @@ internal class CustomExoPlayerView(
|
|||||||
params.bottomMargin = offset.toInt()
|
params.bottomMargin = offset.toInt()
|
||||||
it.layoutParams = params
|
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() {
|
override fun onSingleTap() {
|
||||||
@ -576,5 +593,6 @@ internal class CustomExoPlayerView(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val SUBTITLE_BOTTOM_PADDING_FRACTION = 0.158f
|
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:layout_gravity="top"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingStart="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp" >
|
||||||
android:paddingEnd="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -41,8 +40,8 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/lock_player"
|
android:id="@+id/lock_player"
|
||||||
style="@style/PlayerControlTop"
|
style="@style/PlayerControlTop"
|
||||||
android:scaleX=".8"
|
android:scaleX="0.8"
|
||||||
android:scaleY=".8"
|
android:scaleY="0.8"
|
||||||
android:src="@drawable/ic_unlocked" />
|
android:src="@drawable/ic_unlocked" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user