https://github.com/jintin/intention
Intention is a tool to help you materialize your intent from interface for Android.
https://github.com/jintin/intention
android annotation-processing intent kotlin
Last synced: about 11 hours ago
JSON representation
Intention is a tool to help you materialize your intent from interface for Android.
- Host: GitHub
- URL: https://github.com/jintin/intention
- Owner: Jintin
- License: apache-2.0
- Created: 2020-12-23T01:05:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T08:54:18.000Z (over 5 years ago)
- Last Synced: 2025-03-18T06:48:07.698Z (about 1 year ago)
- Topics: android, annotation-processing, intent, kotlin
- Language: Kotlin
- Homepage:
- Size: 141 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```kotlin
@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:
```kotlin
// generate intent
val intent = MainActivityRouterUtil.getIntent(this, "myData")
// get data from intent
intent.getStringExtra("MyKey") // "myData"
intent.getIntExtra("MyKey2", 0) // 345
```