Skip to content

1.5.25-beta

Compare
Choose a tag to compare
@raamcosta raamcosta released this 02 Nov 20:59
· 472 commits to main since this release
7eb12cc

Changes

  • Fixes #279: Implemented support for activity destinations.

Example:

data class OtherActivityNavArgs(
    val otherThing: String,
    val color: Color
)

@SettingsNavGraph
@ActivityDestination(
    navArgsDelegate = OtherActivityNavArgs::class,
)
class OtherActivity: ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val args = OtherActivityDestination.argsFrom(intent)
        println("OtherActivity args = $args")

        setContentView(ComposeView(this).apply {
            setContent {
                Column(
                    modifier = Modifier.background(args.color)
                ) {
                    Text("OTHER ACTIVITY")
                    Text("ARGS: \n$args")
                }
            }
        })
    }
}

And to navigate to it:

navigator.navigate(OtherActivityDestination(otherThing = "testing", color = Color.Magenta))