Jintin / Intention

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:Apache License 2.0


Languages

Language:Kotlin 100.0%