Skip to content

Commit e39a3f0

Browse files
committed
Chore: 상태바 색상 변경 로직 개선
1 parent 46cd872 commit e39a3f0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/src/main/java/com/threegap/bitnagil/navigation/home/HomeNavHost.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxSize
1111
import androidx.compose.foundation.layout.padding
1212
import androidx.compose.material3.Scaffold
1313
import androidx.compose.runtime.Composable
14+
import androidx.compose.runtime.LaunchedEffect
1415
import androidx.compose.runtime.SideEffect
1516
import androidx.compose.runtime.getValue
1617
import androidx.compose.runtime.mutableLongStateOf
@@ -56,7 +57,7 @@ fun HomeNavHost(
5657

5758
val activity = LocalActivity.current
5859
val isHomeTab = navigator.isHomeRoute
59-
SideEffect {
60+
LaunchedEffect(isHomeTab) {
6061
activity?.setStatusBarContentColor(isLightContent = isHomeTab)
6162
}
6263

app/src/main/java/com/threegap/bitnagil/util/UiExtensions.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import androidx.core.view.WindowCompat
55

66
fun Activity.setStatusBarContentColor(isLightContent: Boolean) {
77
val window = this.window
8-
val view = window.decorView
9-
val wic = WindowCompat.getInsetsController(window, view)
8+
val wic = WindowCompat.getInsetsController(window, window.decorView)
109

11-
wic.isAppearanceLightStatusBars = !isLightContent
10+
val targetAppearance = !isLightContent
11+
12+
if (wic.isAppearanceLightStatusBars != targetAppearance) {
13+
wic.isAppearanceLightStatusBars = targetAppearance
14+
}
1215
}

0 commit comments

Comments
 (0)