Skip to content

Intention is a tool to help you materialize your intent from interface for Android.

License

Notifications You must be signed in to change notification settings

Jintin/Intention

Repository files navigation

Intention

Intention is a tool to help you materialize your intent easily for Android.

All you need to do is to provide an interface contract of how to generate your Intent with context and your data.

Contract example:

@Intention(MainActivity::class)
interface MainActivityRouter {

    fun getIntent(
        context: Context,
        @Extra("MyKey") value: String?,
        @Extra("MyKey2") value2: Int = 345
    ): Intent

}

After compiler the generate class will name as the interface with suffix Util and you can use it directly!

Usage example:

// generate intent
val intent = MainActivityRouterUtil.getIntent(this, "myData")

// get data from intent
intent.getStringExtra("MyKey") // "myData"
intent.getIntExtra("MyKey2", 0) // 345

About

Intention is a tool to help you materialize your intent from interface for Android.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages