Skip to content

Commit 1f58160

Browse files
authored
UI fixes for portrait subtitle offset dialog (#2228)
1 parent 96558ba commit 1f58160

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,9 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
553553
setContentView(binding.root)
554554
}
555555
dialog.show()
556-
fixSystemBarsPadding(binding.root)
556+
557+
val isPortrait = ctx.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
558+
fixSystemBarsPadding(binding.root, fixIme = isPortrait)
557559

558560
var currentOffset = subtitleDelay
559561
binding.apply {

app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ object UIHelper {
427427
padBottom: Boolean = true,
428428
padLeft: Boolean = true,
429429
padRight: Boolean = true,
430-
overlayCutout: Boolean = true
430+
overlayCutout: Boolean = true,
431+
fixIme: Boolean = false
431432
) {
432433
// edge-to-edge is very buggy on earlier versions so we just
433434
// handle the status bar here instead.
@@ -443,10 +444,11 @@ object UIHelper {
443444
val leftCheck = if (view.isRtl()) padRight else padLeft
444445
val rightCheck = if (view.isRtl()) padLeft else padRight
445446

446-
val insets = windowInsets.getInsets(
447-
WindowInsetsCompat.Type.systemBars()
448-
or WindowInsetsCompat.Type.displayCutout()
449-
)
447+
val insetTypes = WindowInsetsCompat.Type.systemBars() or
448+
WindowInsetsCompat.Type.displayCutout() or
449+
if (fixIme) WindowInsetsCompat.Type.ime() else 0
450+
451+
val insets = windowInsets.getInsets(insetTypes)
450452

451453
view.updatePadding(
452454
left = if (leftCheck) insets.left else view.paddingLeft,

app/src/main/res/layout-port/subtitle_offset.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
android:id="@+id/subtitle_offset_subtract_more"
6868
android:layout_width="44dp"
6969
android:layout_height="44dp"
70-
android:layout_weight="1"
7170
android:background="?android:attr/selectableItemBackgroundBorderless"
7271
android:padding="10dp"
7372
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"
@@ -78,7 +77,6 @@
7877
android:id="@+id/subtitle_offset_subtract"
7978
android:layout_width="44dp"
8079
android:layout_height="44dp"
81-
android:layout_weight="1"
8280
android:background="?android:attr/selectableItemBackgroundBorderless"
8381
android:padding="10dp"
8482
android:src="@drawable/baseline_remove_24"
@@ -90,8 +88,8 @@
9088
android:layout_width="0dp"
9189
android:layout_height="wrap_content"
9290
android:layout_weight="1"
93-
android:autofillHints="no"
9491
android:gravity="center"
92+
android:autofillHints="no"
9593
android:hint="@string/subtitle_offset_hint"
9694
android:inputType="numberSigned"
9795
tools:ignore="LabelFor" />
@@ -100,7 +98,6 @@
10098
android:id="@+id/subtitle_offset_add"
10199
android:layout_width="44dp"
102100
android:layout_height="44dp"
103-
android:layout_weight="1"
104101
android:background="?android:attr/selectableItemBackgroundBorderless"
105102
android:padding="10dp"
106103
android:src="@drawable/ic_baseline_add_24"
@@ -111,7 +108,6 @@
111108
android:id="@+id/subtitle_offset_add_more"
112109
android:layout_width="44dp"
113110
android:layout_height="44dp"
114-
android:layout_weight="1"
115111
android:background="?android:attr/selectableItemBackgroundBorderless"
116112
android:padding="10dp"
117113
android:src="@drawable/ic_baseline_keyboard_arrow_right_24"

0 commit comments

Comments
 (0)