A framework for Android modal dialog
| module | trouter-api | trouter-compiler | trouter-annotation |
|---|---|---|---|
| version | |||
| version-log | api-log | compiler-log | annotation-log |
- Support for multi-module
- Support parameter passing
- Support window drag
- Support multiple ways to configure transition animation and custom animation
- …………
-
Adding dependencies and configurations
android { ... kapt { arguments { arg("TROUTER_MODULE_NAME", project.name) } } } dependencies { // Replace with the latest version implementation 'io.github.huaj1a:trouter-api:?' kapt 'io.github.huaj1a:trouter-compiler:?' ... }
-
Add annotations
// Add annotations on pages that support routing (required) // The path here needs to pay attention to need at least two levels : /xx/xx @Route( path = "/dialog/BasicComposeDialog", height = 0.5f, width = 0.75f ) class BasicComposeDialog(context: Context): BaseComposeModalDialog(context) { …… }
-
Initialize the SDK
if (isDebug()) { TRouter.openLog() } TRouter.getInstance().init(activity)
-
Initiate the routing
TRouter.getInstance() .build("/dialog/BasicComposeDialog") .withModalType(ModalType.MODAL) .navigation() TRouter.getInstance() .build(BundleDialogPath) .withBundle(BundleDialog.KEY_INT, 123456) .withBundle(BundleDialog.KEY_FLOAT, 3.14159f) .withBundle(BundleDialog.KEY_TIME, System.currentTimeMillis()) .withBundle(BundleDialog.KEY_STRING, "Hello TRouter") .withBundle(BundleDialog.KEY_LIST_INT, listOf(1, 3, 5)) .withBundle(BundleDialog.KEY_LIST_STRING, listOf("apple", "banana", "orange")) .withBundle(BundleDialog.KEY_OBJECT, BundleTest(654321, 1.2345f, System.currentTimeMillis(), "Hello Android", listOf(2, 4, 6), listOf("java", "kotlin", "c++") )) .navigation()
-
Add confusing rules (If Proguard is turn on)
-keep class com.huaj1a.trouter.** -keep interface com.huaj1a.trouter.** -keep class * extends com.huaj1a.trouter.ui.BaseModalDialog {*;}
thanks for ARouter。
Maybe not a production framework, but I hope it's something fun
light up star ~