Skip to content

Commit

Permalink
Fixed status bar color and other updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
android-dev-lxl committed Mar 5, 2024
1 parent adaeca4 commit 4aafa1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/example/superheroes/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import com.example.superheroes.ui.theme.SuperheroesTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
SuperheroesTheme {
// A surface container using the 'background' color from the theme
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/example/superheroes/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
Expand Down Expand Up @@ -116,8 +117,8 @@ fun SuperheroesTheme(
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
window.statusBarColor = Color.Transparent.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.2" apply false
id("com.android.library") version "8.1.2" apply false
id("com.android.application") version "8.1.3" apply false
id("com.android.library") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
}

0 comments on commit 4aafa1f

Please sign in to comment.