Add compose navigation
This commit is contained in:
parent
36ff52cd2b
commit
4ad3ec049b
@ -240,6 +240,10 @@ dependencyResolutionManagement {
|
||||
)
|
||||
)
|
||||
|
||||
alias("androidx.navigation.compose")
|
||||
.to("androidx.navigation", "navigation-compose")
|
||||
.version("2.4.0-alpha09")
|
||||
|
||||
alias("materialcomponents")
|
||||
.to("com.google.android.material", "material")
|
||||
.version("1.5.0-alpha02")
|
||||
|
||||
@ -61,6 +61,8 @@ dependencies {
|
||||
implementation(libs.androidx.compose.animation)
|
||||
implementation(libs.androidx.compose.animationgraphics)
|
||||
|
||||
implementation(libs.androidx.navigation.compose)
|
||||
|
||||
// Legacy dependencies
|
||||
implementation(libs.androidx.transition)
|
||||
implementation(libs.materialcomponents)
|
||||
|
||||
@ -14,12 +14,15 @@ import androidx.compose.ui.geometry.Size
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.doOnLayout
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.google.accompanist.insets.ProvideWindowInsets
|
||||
import de.mm20.launcher2.ui.LauncherMainScreen
|
||||
import de.mm20.launcher2.ui.LauncherTheme
|
||||
import de.mm20.launcher2.ui.locals.LocalAppWidgetHost
|
||||
import de.mm20.launcher2.ui.locals.LocalColorScheme
|
||||
import de.mm20.launcher2.ui.locals.LocalWindowSize
|
||||
import de.mm20.launcher2.ui.screens.LauncherMainScreen
|
||||
import de.mm20.launcher2.ui.theme.WallpaperColors
|
||||
import de.mm20.launcher2.ui.theme.colors.DefaultColorScheme
|
||||
import de.mm20.launcher2.ui.theme.colors.WallpaperColorScheme
|
||||
@ -39,6 +42,8 @@ class ComposeActivity : AppCompatActivity() {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
setContent {
|
||||
val navController = rememberNavController()
|
||||
|
||||
var windowSize by remember { mutableStateOf(Size(0f, 0f)) }
|
||||
findViewById<View>(android.R.id.content).doOnLayout {
|
||||
windowSize = Size(it.width.toFloat(), it.height.toFloat())
|
||||
@ -85,7 +90,11 @@ class ComposeActivity : AppCompatActivity() {
|
||||
LocalColorScheme provides colorScheme,
|
||||
) {
|
||||
LauncherTheme {
|
||||
LauncherMainScreen()
|
||||
NavHost(navController = navController, startDestination = "home") {
|
||||
composable("home") {
|
||||
LauncherMainScreen(navController)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ import kotlinx.coroutines.launch
|
||||
InternalCoroutinesApi::class
|
||||
)
|
||||
@Composable
|
||||
fun LauncherMainScreen() {
|
||||
fun LauncherMainScreen(navController: NavController) {
|
||||
|
||||
val systemUiController = rememberSystemUiController()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user