|
|
|
@ -37,6 +37,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
|
|
import androidx.lifecycle.repeatOnLifecycle
|
|
|
|
|
import androidx.metrics.performance.JankStats
|
|
|
|
|
import androidx.tracing.trace
|
|
|
|
|
import com.google.samples.apps.nowinandroid.MainActivityUiState.Loading
|
|
|
|
|
import com.google.samples.apps.nowinandroid.MainActivityUiState.Success
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.analytics.AnalyticsHelper
|
|
|
|
@ -110,7 +111,7 @@ class MainActivity : ComponentActivity() {
|
|
|
|
|
// Turn off the decor fitting system windows, which allows us to handle insets,
|
|
|
|
|
// including IME animations, and go edge-to-edge
|
|
|
|
|
// This also sets up the initial system bar style based on the platform theme
|
|
|
|
|
enableEdgeToEdge()
|
|
|
|
|
trace("niaEdgeToEdge") { enableEdgeToEdge() }
|
|
|
|
|
|
|
|
|
|
setContent {
|
|
|
|
|
val darkTheme = shouldUseDarkTheme(uiState)
|
|
|
|
@ -120,6 +121,7 @@ class MainActivity : ComponentActivity() {
|
|
|
|
|
// resolve whether or not to show dark theme using uiState, since it can be different
|
|
|
|
|
// than the configuration's dark theme value based on the user preference.
|
|
|
|
|
DisposableEffect(darkTheme) {
|
|
|
|
|
trace("niaEdgeToEdge") {
|
|
|
|
|
enableEdgeToEdge(
|
|
|
|
|
statusBarStyle = SystemBarStyle.auto(
|
|
|
|
|
android.graphics.Color.TRANSPARENT,
|
|
|
|
@ -132,6 +134,7 @@ class MainActivity : ComponentActivity() {
|
|
|
|
|
)
|
|
|
|
|
onDispose {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val appState = rememberNiaAppState(
|
|
|
|
|
windowSizeClass = calculateWindowSizeClass(this),
|
|
|
|
|