Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:56:56 +01:00
parent 75dc487a7a
commit 39c29d175b
6317 changed files with 388324 additions and 2 deletions

View file

@ -0,0 +1,8 @@
plugins {
id(ThunderbirdPlugins.Library.androidCompose)
}
android {
namespace = "app.k9mail.core.ui.compose.navigation"
resourcePrefix = "core_ui_navigation_"
}

View file

@ -0,0 +1,24 @@
package app.k9mail.core.ui.compose.navigation
import androidx.navigation.NavGraphBuilder
/**
* A Navigation is responsible for registering routes with the navigation graph.
*
* @param T the type of route
*/
interface Navigation<T : Route> {
/**
* Register all routes for this navigation.
*
* @param navGraphBuilder the navigation graph builder
* @param onBack the action to perform when the back button is pressed
* @param onFinish the action to perform when a route is finished
*/
fun registerRoutes(
navGraphBuilder: NavGraphBuilder,
onBack: () -> Unit,
onFinish: (T) -> Unit,
)
}

View file

@ -0,0 +1,22 @@
package app.k9mail.core.ui.compose.navigation
import androidx.compose.animation.AnimatedContentScope
import androidx.compose.runtime.Composable
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import androidx.navigation.navDeepLink
inline fun <reified T : Route> NavGraphBuilder.deepLinkComposable(
basePath: String,
noinline content: @Composable AnimatedContentScope.(NavBackStackEntry) -> Unit,
) {
composable<T>(
deepLinks = listOf(
navDeepLink<T>(
basePath = basePath,
),
),
content = content,
)
}

View file

@ -0,0 +1,18 @@
package app.k9mail.core.ui.compose.navigation
/**
* A Route represents a destination in the app.
*
* It is used to navigate to a specific screen using type-safe composable navigation
* and deep links.
*
* @see Navigation
*/
interface Route {
val basePath: String
/**
* The route to navigate to this screen.
*/
fun route(): String
}