安利一个多线程连续触发器的框架,项目地址 ContinuousTrigger
用于按序执行一系列任务,可随时绑定(如接口返回),可对每个步骤设置超时响应时间。
使用起来非常简单,首先注册任务 ContinuousTrigger.Builder().with() 传入Trigger对象并定义好ID(支持链式)
然后任意一个任务准备好(如接口数据已经返回成功)后,通过attch方法传入ID和实现即可按序触发
如果某一个任务需要阻塞任务队列(如Dialog 关闭之后再弹下一个)只需在构造的时候设置 chokeMode = true 并在使用完毕后调用next()方法继续向下执行即可
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.iostyle:ContinuousTrigger:1.0.3'
}