Skip to content

Commit 1745248

Browse files
committed
完善代码
1 parent 27ed3c4 commit 1745248

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

module-communication-route/src/main/java/com/flyjingfish/module_communication_route/ModuleRoute.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,15 @@ object ModuleRoute {
147147
}
148148

149149
private fun goActivity(context: Context,intent: Intent){
150-
val onGoActivity = this.onGoActivity
151150
if (Looper.getMainLooper() == Looper.myLooper()){
152-
if (onGoActivity != null){
153-
onGoActivity.onGo(context, intent)
154-
return
151+
val onGoActivity = this.onGoActivity
152+
if (onGoActivity?.onGo(context, intent) == false){
153+
context.startActivity(intent)
155154
}
156-
context.startActivity(intent)
157155
}else{
158156
handler.post {
159-
if (onGoActivity != null){
160-
onGoActivity.onGo(context, intent)
161-
}else{
157+
val onGoActivity = this.onGoActivity
158+
if (onGoActivity?.onGo(context, intent) == false){
162159
context.startActivity(intent)
163160
}
164161
}
@@ -174,7 +171,7 @@ object ModuleRoute {
174171
}
175172

176173
/**
177-
* 跳转页面,需要 [ModuleRoute].[setApplication] 来初始化 application.
174+
* 跳转页面,需要 [ModuleRoute.setApplication] 来初始化 application.
178175
* @param onNavigationBack 返回跳转结果
179176
*/
180177
fun go(onNavigationBack: OnNavigationBack ?= null):Any? {

module-communication-route/src/main/java/com/flyjingfish/module_communication_route/callback/OnGoActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ import android.content.Intent
77
* 设置此项之后 你需要自己去写 [Context.startActivity]
88
*/
99
interface OnGoActivity {
10-
fun onGo(context: Context, intent: Intent)
10+
fun onGo(context: Context, intent: Intent):Boolean
1111
}

0 commit comments

Comments
 (0)