Skip to content

Commit b3db74f

Browse files
committed
Fix issue with status bar style
1 parent 8cc72d3 commit b3db74f

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

app/src/main/kotlin/org/btcmap/map/MapFragment.kt

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,18 @@ class MapFragment : Fragment() {
517517
private fun BottomSheetBehavior<*>.addSlideCallback() {
518518
addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
519519
override fun onStateChanged(bottomSheet: View, newState: Int) {
520+
if (newState == BottomSheetBehavior.STATE_EXPANDED) {
521+
styleStatusBar()
522+
}
523+
520524
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
521525
viewLifecycleOwner.lifecycleScope.launch { selectPlace(null) }
522526
}
523527
}
524528

525529
override fun onSlide(bottomSheet: View, slideOffset: Float) {
526530
placeFragment.onSlide(slideOffset)
531+
styleStatusBar()
527532
}
528533
})
529534
}
@@ -557,17 +562,22 @@ class MapFragment : Fragment() {
557562
}
558563

559564
fun styleStatusBar() {
560-
when (prefs.mapStyle) {
561-
MapStyle.Auto -> {
562-
val nightMode =
563-
requireContext().resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
564-
insetsController?.isAppearanceLightStatusBars = !nightMode
565-
}
565+
val nightMode =
566+
requireContext().resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
566567

567-
MapStyle.Dark,
568-
MapStyle.CartoDarkMatter -> insetsController?.isAppearanceLightStatusBars = false
568+
if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) {
569+
insetsController?.isAppearanceLightStatusBars = !nightMode
570+
} else {
571+
when (prefs.mapStyle) {
572+
MapStyle.Auto -> {
573+
insetsController?.isAppearanceLightStatusBars = !nightMode
574+
}
569575

570-
else -> insetsController?.isAppearanceLightStatusBars = true
576+
MapStyle.Dark,
577+
MapStyle.CartoDarkMatter -> insetsController?.isAppearanceLightStatusBars = false
578+
579+
else -> insetsController?.isAppearanceLightStatusBars = true
580+
}
571581
}
572582
}
573583

0 commit comments

Comments
 (0)