Skip to content

Commit ede1fad

Browse files
authored
Make fixSystemBarsPadding not accept a null View (#2114)
1 parent ec06da6 commit ede1fad

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,19 +1262,21 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
12621262
null
12631263
}
12641264

1265-
fixSystemBarsPadding(
1266-
binding?.navView,
1267-
heightResId = R.dimen.nav_view_height,
1268-
padTop = false,
1269-
overlayCutout = false
1270-
)
1265+
binding?.apply {
1266+
fixSystemBarsPadding(
1267+
navView,
1268+
heightResId = R.dimen.nav_view_height,
1269+
padTop = false,
1270+
overlayCutout = false
1271+
)
12711272

1272-
fixSystemBarsPadding(
1273-
binding?.navRailView,
1274-
widthResId = R.dimen.nav_rail_view_width,
1275-
padRight = false,
1276-
padTop = false
1277-
)
1273+
fixSystemBarsPadding(
1274+
navRailView,
1275+
widthResId = R.dimen.nav_rail_view_width,
1276+
padRight = false,
1277+
padTop = false
1278+
)
1279+
}
12781280

12791281
// overscan
12801282
val padding = settingsManager.getInt(getString(R.string.overscan_key), 0).toPx

app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragmentPhone.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,15 @@ open class ResultFragmentPhone : FullScreenPlayer() {
326326

327327
override fun onConfigurationChanged(newConfig: Configuration) {
328328
super.onConfigurationChanged(newConfig)
329-
fixSystemBarsPadding(binding?.root)
329+
view?.let { fixSystemBarsPadding(it) }
330330
}
331331

332332
@SuppressLint("SetTextI18n")
333333
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
334334
super.onViewCreated(view, savedInstanceState)
335335

336336
// ===== setup =====
337-
fixSystemBarsPadding(binding?.root)
337+
fixSystemBarsPadding(view)
338338
val storedData = getStoredData() ?: return
339339
activity?.window?.decorView?.clearFocus()
340340
activity?.loadCache()

app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ class SettingsFragment : BaseFragment<MainSettingsBinding>(
143143
}
144144

145145
fun Fragment.setSystemBarsPadding() {
146-
fixSystemBarsPadding(
147-
view,
148-
padLeft = isLayout(TV or EMULATOR),
149-
padBottom = isLandscape()
150-
)
146+
view?.let {
147+
fixSystemBarsPadding(
148+
it,
149+
padLeft = isLayout(TV or EMULATOR),
150+
padBottom = isLandscape()
151+
)
152+
}
151153
}
152154

153155
fun getFolderSize(dir: File): Long {

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ object UIHelper {
423423
}
424424

425425
fun fixSystemBarsPadding(
426-
v: View?,
426+
v: View,
427427
@DimenRes heightResId: Int? = null,
428428
@DimenRes widthResId: Int? = null,
429429
padTop: Boolean = true,
@@ -432,8 +432,6 @@ object UIHelper {
432432
padRight: Boolean = true,
433433
overlayCutout: Boolean = true
434434
) {
435-
if (v == null) return
436-
437435
// edge-to-edge is very buggy on earlier versions so we just
438436
// handle the status bar here instead.
439437
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {

0 commit comments

Comments
 (0)