安利一個多線程連續(xù)觸發(fā)器的框架闷旧,項目地址?ContinuousTrigger?
用于按序執(zhí)行一系列任務(wù),可隨時綁定(如接口返回),可對每個步驟設(shè)置超時響應(yīng)時間吃度。
使用起來非常簡單,首先注冊任務(wù)?ContinuousTrigger.Builder().with() 傳入Trigger對象并定義好ID(支持鏈?zhǔn)剑?/p>
然后任意一個任務(wù)準(zhǔn)備好(如接口數(shù)據(jù)已經(jīng)返回成功)后责语,通過attch方法傳入ID和實現(xiàn)即可按序觸發(fā)
如果某一個任務(wù)需要阻塞任務(wù)隊列(如Dialog 關(guān)閉之后再彈下一個)只需在構(gòu)造的時候設(shè)置?chokeMode = true 并在使用完畢后調(diào)用next()方法繼續(xù)向下執(zhí)行即可
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'
}