Skip to content

Commit 3b767e0

Browse files
authored
feat: add more system bar appearance helper extensions (#250)
1 parent e0eab22 commit 3b767e0

File tree

1 file changed

+10
-0
lines changed
  • commons/src/main/kotlin/org/fossify/commons/extensions

1 file changed

+10
-0
lines changed

commons/src/main/kotlin/org/fossify/commons/extensions/Window.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ fun Window.setSystemBarsAppearance(backgroundColor: Int) {
1818
}
1919
}
2020

21+
fun Window.setStatusBarAppearance(backgroundColor: Int) {
22+
val isLightBackground = backgroundColor.getContrastColor() == DARK_GREY
23+
insetsController().isAppearanceLightStatusBars = isLightBackground
24+
}
25+
26+
fun Window.setNavigationBarAppearance(backgroundColor: Int) {
27+
val isLightBackground = backgroundColor.getContrastColor() == DARK_GREY
28+
insetsController().isAppearanceLightNavigationBars = isLightBackground
29+
}
30+
2131
fun Window.showBars() = insetsController().apply {
2232
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_DEFAULT
2333
show(WindowInsetsCompat.Type.systemBars())

0 commit comments

Comments
 (0)