Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owl is laid out edge-to-edge in 2 & 3-button navigation mode #1265

Closed
wants to merge 8 commits into from
9 changes: 0 additions & 9 deletions Owl/app/src/main/java/com/example/owl/ui/MainActivity.kt
Expand Up @@ -18,20 +18,11 @@ package com.example.owl.ui

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.core.content.ContextCompat
import com.example.owl.R

class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(
ContextCompat.getColor(this, R.color.immersive_sys_ui)
)
)
super.onCreate(savedInstanceState)

setContent {
Expand Down
16 changes: 16 additions & 0 deletions Owl/app/src/main/java/com/example/owl/ui/theme/Theme.kt
Expand Up @@ -16,6 +16,9 @@

package com.example.owl.ui.theme

import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme
Expand All @@ -26,7 +29,9 @@ import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import com.example.owl.R

private val YellowThemeLight = lightColors(
Expand Down Expand Up @@ -125,6 +130,17 @@ private fun OwlTheme(
colors: Colors,
content: @Composable () -> Unit
) {
val transparent = android.graphics.Color.TRANSPARENT
val activity = LocalContext.current as ComponentActivity
activity.enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(
ContextCompat.getColor(activity, R.color.immersive_sys_ui)
),
navigationBarStyle = if (darkTheme)
SystemBarStyle.dark(transparent)
else
SystemBarStyle.light(transparent, transparent)
)
val elevation = if (darkTheme) DarkElevation else LightElevation
val images = if (darkTheme) DarkImages else LightImages
CompositionLocalProvider(
Expand Down