diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4513c8bc..e8e9ef4a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -54,7 +54,7 @@ dependencies { implementation(libs.bundles.android.base) - val composeBom = platform("androidx.compose:compose-bom:2023.01.00") + val composeBom = platform("androidx.compose:compose-bom:2024.05.00") implementation(composeBom) androidTestImplementation(composeBom) @@ -77,7 +77,7 @@ dependencies { implementation("androidx.compose.material3:material3-window-size-class") // Optional - Integration with activities - implementation("androidx.activity:activity-compose:1.7.1") + implementation("androidx.activity:activity-compose:1.9.0") // Optional - Integration with ViewModels implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e36565fd..8c455dc2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,10 +17,10 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.AppCompat" - android:screenOrientation="portrait" tools:targetApi="31"> diff --git a/app/src/main/java/com/whyranoid/walkie/MainActivity.kt b/app/src/main/java/com/whyranoid/walkie/MainActivity.kt index f80c82dc..480379c4 100644 --- a/app/src/main/java/com/whyranoid/walkie/MainActivity.kt +++ b/app/src/main/java/com/whyranoid/walkie/MainActivity.kt @@ -4,6 +4,7 @@ import android.os.Build import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge import androidx.annotation.RequiresApi import com.whyranoid.presentation.screens.AppScreen import com.whyranoid.presentation.theme.WalkieTheme @@ -13,6 +14,9 @@ class MainActivity : ComponentActivity() { @RequiresApi(Build.VERSION_CODES.TIRAMISU) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + enableEdgeToEdge() + setContent { WalkieTheme { AppManageDialog() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a422400..8c02ccce 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] androidx-navigation = "2.5.3" -androidx-core = "1.9.0" +androidx-core = "1.13.1" androidx-appcompat = "1.6.1" androidx-constraintlayout = "2.1.4" naver-maps-android-sdk = "3.16.2" diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index cb3066de..17f5a5c3 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -58,7 +58,7 @@ dependencies { implementation(libs.bundles.android.base) - val composeBom = platform("androidx.compose:compose-bom:2023.01.00") + val composeBom = platform("androidx.compose:compose-bom:2024.05.00") implementation(composeBom) androidTestImplementation(composeBom) @@ -88,7 +88,7 @@ dependencies { implementation("androidx.compose.material3:material3-window-size-class") // Optional - Integration with activities - implementation("androidx.activity:activity-compose:1.7.1") + implementation("androidx.activity:activity-compose:1.9.0") // Optional - Integration with ViewModels implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1") diff --git a/presentation/src/main/java/com/whyranoid/presentation/screens/AppScreen.kt b/presentation/src/main/java/com/whyranoid/presentation/screens/AppScreen.kt index c0556753..f1c7539e 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/screens/AppScreen.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/screens/AppScreen.kt @@ -2,6 +2,7 @@ package com.whyranoid.presentation.screens import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.size import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem @@ -70,6 +71,7 @@ fun AppScreenContent( navController: NavHostController, ) { Scaffold( + modifier = Modifier.safeDrawingPadding(), bottomBar = { val navBackStackEntry by navController.currentBackStackEntryAsState() val currentDestination = navBackStackEntry?.destination diff --git a/presentation/src/main/java/com/whyranoid/presentation/theme/Theme.kt b/presentation/src/main/java/com/whyranoid/presentation/theme/Theme.kt index d25a2507..8279bab1 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/theme/Theme.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/theme/Theme.kt @@ -1,13 +1,19 @@ package com.whyranoid.presentation.theme +import android.app.Activity import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.SideEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.graphics.Color -import com.google.accompanist.systemuicontroller.rememberSystemUiController +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat // TODO: Dark Theme private val DarkColorScheme = darkColorScheme( @@ -41,6 +47,19 @@ fun WalkieTheme( dynamicColor: Boolean = true, content: @Composable () -> Unit, ) { + val view = LocalView.current + val statusBarColor by remember { mutableIntStateOf(Color.White.toArgb()) } + val systemNavigationBarColor by remember { mutableIntStateOf(Color.White.toArgb()) } + + if (view.isInEditMode.not()) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = statusBarColor + window.navigationBarColor = systemNavigationBarColor + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = true + WindowCompat.getInsetsController(window, view).isAppearanceLightNavigationBars = true + } + } // TODO : Dynamic Color val colorScheme = when { @@ -48,26 +67,6 @@ fun WalkieTheme( else -> LightColorScheme } - // Remember a SystemUiController - val systemUiController = rememberSystemUiController() - - DisposableEffect(systemUiController, darkTheme) { - - systemUiController.setSystemBarsColor( - color = Color.Transparent, - darkIcons = darkTheme.not() - ) - - systemUiController.setStatusBarColor( - color = colorScheme.surface, - darkIcons = darkTheme.not() - ) { requestedColor -> - requestedColor - } - - onDispose {} - } - MaterialTheme( colorScheme = LightColorScheme, content = content,