-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from BottleRocketStudios/main
Deploy v0.5.0
- Loading branch information
Showing
12 changed files
with
131 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 19 additions & 23 deletions
42
...monMain/kotlin/com/bottlerocketstudios/launchpad/compose/example/navigation/ExampleApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
package com.bottlerocketstudios.launchpad.compose.example.navigation | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import com.bottlerocketstudios.launchpad.compose.navigation.utils.WindowWidthSizeClass | ||
import moe.tlaster.precompose.navigation.NavHost | ||
import moe.tlaster.precompose.navigation.Navigator | ||
import moe.tlaster.precompose.navigation.transition.NavTransition | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun ExampleApp( | ||
widthSize: WindowWidthSizeClass, | ||
navigator: Navigator?, | ||
bottomBar: @Composable () -> Unit | ||
navigator: NavHostController, | ||
// bottomBar: @Composable () -> Unit | ||
) { | ||
Scaffold( | ||
topBar = { TopAppBar(title = { Text("Example App") }) }, | ||
bottomBar = bottomBar | ||
) { | ||
navigator?.let { navController -> | ||
NavHost( | ||
// Assign the navigator to the NavHost | ||
navigator = navController, | ||
// Navigation transition for the scenes in this NavHost, this is optional | ||
navTransition = NavTransition(), | ||
// The start destination | ||
initialRoute = "/home", | ||
modifier = Modifier.padding(it) | ||
) { | ||
// Navgraph goes here | ||
} | ||
} | ||
} | ||
// FIXME - after testing | ||
// Column( | ||
// topBar = { TopAppBar(title = { Text("Example App") }) }, | ||
// bottomBar = bottomBar | ||
// ) { | ||
// NavHost( | ||
// navController = navigator, | ||
// startDestination = "/home", | ||
// modifier = Modifier.padding(it) | ||
// ) { | ||
// // Navgraph goes here | ||
// } | ||
// } | ||
} | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
.../desktopMain/kotlin/com/bottlerocketstudios/launchpad/compose/util/WindowUtils.desktop.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.bottlerocketstudios.launchpad.compose.util | ||
|
||
import androidx.compose.ui.window.WindowState | ||
import com.bottlerocketstudios.launchpad.compose.navigation.utils.WindowWidthSizeClass | ||
|
||
fun WindowState.getWindowWidthSizeClass() = | ||
when (size.width.value.toLong()) { | ||
in 840..Int.MAX_VALUE -> WindowWidthSizeClass.Expanded | ||
in 600..840 -> WindowWidthSizeClass.Medium | ||
in Int.MIN_VALUE..600 -> WindowWidthSizeClass.Compact | ||
else -> WindowWidthSizeClass.Medium | ||
} |
14 changes: 14 additions & 0 deletions
14
...pose/src/iosMain/kotlin/com/bottlerocketstudios/launchpad/compose/util/WindowUtils.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.bottlerocketstudios.launchpad.compose.util | ||
|
||
import com.bottlerocketstudios.launchpad.compose.navigation.utils.WindowWidthSizeClass | ||
import kotlinx.cinterop.ExperimentalForeignApi | ||
import platform.UIKit.UIWindow | ||
|
||
@OptIn(ExperimentalForeignApi::class) | ||
fun UIWindow.getWindowWidthSizeClass() = | ||
when (bounds.size) { | ||
in 840..Int.MAX_VALUE -> WindowWidthSizeClass.Expanded | ||
in 600..840 -> WindowWidthSizeClass.Medium | ||
in Int.MIN_VALUE..600 -> WindowWidthSizeClass.Compact | ||
else -> WindowWidthSizeClass.Medium | ||
} |
10 changes: 0 additions & 10 deletions
10
...lin/com/bottlerocketstudios/launchpad/compose/util/navigation/CalculateWindowWidthSize.kt
This file was deleted.
Oops, something went wrong.