Skip to content

Commit 9361861

Browse files
authored
1 parent 78db96e commit 9361861

File tree

4 files changed

+4
-29
lines changed

4 files changed

+4
-29
lines changed

solution/app/src/main/java/com/example/mountainmarkers/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package com.example.mountainmarkers
1717
import android.os.Bundle
1818
import androidx.activity.ComponentActivity
1919
import androidx.activity.compose.setContent
20+
import androidx.activity.enableEdgeToEdge
2021
import androidx.activity.viewModels
2122
import androidx.compose.foundation.background
2223
import androidx.compose.material3.MaterialTheme
@@ -44,6 +45,7 @@ import dagger.hilt.android.AndroidEntryPoint
4445
class MainActivity : ComponentActivity() {
4546
override fun onCreate(savedInstanceState: Bundle?) {
4647
super.onCreate(savedInstanceState)
48+
enableEdgeToEdge()
4749

4850
setContent {
4951
val unitsConverter = if (LocalConfiguration.current.locales.get(0).country == "US") {

solution/app/src/main/java/com/example/mountainmarkers/ui/theme/Theme.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.example.mountainmarkers.ui.theme
22

3-
import android.app.Activity
43
import android.os.Build
54
import androidx.compose.foundation.isSystemInDarkTheme
65
import androidx.compose.material3.MaterialTheme
@@ -9,11 +8,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
98
import androidx.compose.material3.dynamicLightColorScheme
109
import androidx.compose.material3.lightColorScheme
1110
import androidx.compose.runtime.Composable
12-
import androidx.compose.runtime.SideEffect
13-
import androidx.compose.ui.graphics.toArgb
1411
import androidx.compose.ui.platform.LocalContext
15-
import androidx.compose.ui.platform.LocalView
16-
import androidx.core.view.WindowCompat
1712

1813
private val DarkColorScheme = darkColorScheme(
1914
primary = Purple80,
@@ -44,15 +39,6 @@ fun MountainMarkersTheme(
4439
else -> LightColorScheme
4540
}
4641

47-
val view = LocalView.current
48-
if (!view.isInEditMode) {
49-
SideEffect {
50-
val window = (view.context as Activity).window
51-
window.statusBarColor = colorScheme.primary.toArgb()
52-
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
53-
}
54-
}
55-
5642
MaterialTheme(
5743
colorScheme = colorScheme,
5844
typography = Typography,

starter/app/src/main/java/com/example/mountainmarkers/MainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package com.example.mountainmarkers
1717
import android.os.Bundle
1818
import androidx.activity.ComponentActivity
1919
import androidx.activity.compose.setContent
20+
import androidx.activity.enableEdgeToEdge
2021
import androidx.activity.viewModels
2122
import androidx.compose.foundation.background
2223
import androidx.compose.material3.MaterialTheme
@@ -44,6 +45,7 @@ import dagger.hilt.android.AndroidEntryPoint
4445
class MainActivity : ComponentActivity() {
4546
override fun onCreate(savedInstanceState: Bundle?) {
4647
super.onCreate(savedInstanceState)
48+
enableEdgeToEdge()
4749

4850
setContent {
4951
val unitsConverter = if (LocalConfiguration.current.locales.get(0).country == "US") {
@@ -107,4 +109,3 @@ class MainActivity : ComponentActivity() {
107109
}
108110
}
109111
}
110-

starter/app/src/main/java/com/example/mountainmarkers/ui/theme/Theme.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.example.mountainmarkers.ui.theme
22

3-
import android.app.Activity
43
import android.os.Build
54
import androidx.compose.foundation.isSystemInDarkTheme
65
import androidx.compose.material3.MaterialTheme
@@ -9,11 +8,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
98
import androidx.compose.material3.dynamicLightColorScheme
109
import androidx.compose.material3.lightColorScheme
1110
import androidx.compose.runtime.Composable
12-
import androidx.compose.runtime.SideEffect
13-
import androidx.compose.ui.graphics.toArgb
1411
import androidx.compose.ui.platform.LocalContext
15-
import androidx.compose.ui.platform.LocalView
16-
import androidx.core.view.WindowCompat
1712

1813
private val DarkColorScheme = darkColorScheme(
1914
primary = Purple80,
@@ -44,15 +39,6 @@ fun MountainMarkersTheme(
4439
else -> LightColorScheme
4540
}
4641

47-
val view = LocalView.current
48-
if (!view.isInEditMode) {
49-
SideEffect {
50-
val window = (view.context as Activity).window
51-
window.statusBarColor = colorScheme.primary.toArgb()
52-
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
53-
}
54-
}
55-
5642
MaterialTheme(
5743
colorScheme = colorScheme,
5844
typography = Typography,

0 commit comments

Comments
 (0)