Skip to content
huaj1aPublic

About

modal dialog route framework

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

TRouter
    A framework for Android modal dialog

Demo

Apk | Gif

Lastest version

module trouter-api trouter-compiler trouter-annotation
version Download Download Download
version-log api-log compiler-log annotation-log

I. Feature

  1. Support for multi-module
  2. Support parameter passing
  3. Support window drag
  4. Support multiple ways to configure transition animation and custom animation
  5. …………

II. Configuration

  1. 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:?'
        ...
    }
  2. 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) {
       ……
    }
  3. Initialize the SDK

    if (isDebug()) {
        TRouter.openLog()
    }
    TRouter.getInstance().init(activity)
  4. 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()
    
  5. 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 {*;}
    

The ending

thanks for ARouter。

Maybe not a production framework, but I hope it's something fun

light up star ~

About

modal dialog route framework

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages