From 857802778fe3d4d9d8b9d612015b1b9746b32078 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 11:35:32 +0800 Subject: [PATCH 01/13] Make RouterManager as a interface --- .../demoapp/common/router/RouterManager.kt | 80 +++++++++---------- .../demoapp/common/router/RouterPath.kt | 1 - 2 files changed, 36 insertions(+), 45 deletions(-) diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt index 1bfbe5b87..4edc6d8f2 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt @@ -1,53 +1,45 @@ package io.goooler.demoapp.common.router -import android.content.Intent -import androidx.core.net.toUri -import com.alibaba.android.arouter.facade.Postcard -import com.alibaba.android.arouter.launcher.ARouter - -@Suppress("unused", "MemberVisibilityCanBePrivate") -object RouterManager { - const val TARGET = "target" - const val PARAMS = "params" - const val RE_LOGIN = "reLogin" - const val USE_CHROME = "useChrome" - - fun go(url: String) { - url.toUri().path?.let { - buildPostcard(it).navigation() - } - } +import javax.inject.Inject - fun goLogin(isReLogin: Boolean) { - val action = if (isReLogin) RE_LOGIN else null - buildPostcard(RouterPath.LOGIN) - .withAction(action) - .withFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) - .navigation() - } +interface RouterManager { - fun goMain() { - buildPostcard(RouterPath.MAIN) - .navigation() - } + fun go(url: String) - fun goMap() { - buildPostcard(RouterPath.MAP) - .navigation() - } + fun goLogin(isReLogin: Boolean) - fun goAudioPlay() { - buildPostcard(RouterPath.AUDIO_PLAY) - .navigation() - } + fun goMain() - fun goWeb(url: String, useChrome: Boolean = false) { - val action = if (useChrome) USE_CHROME else null - buildPostcard(RouterPath.WEB) - .withAction(action) - .withString(PARAMS, url) - .navigation() - } + fun goAudioPlay() + + fun goWeb(url: String, useChrome: Boolean = false) + + companion object : RouterManager { + const val PARAMS = "params" + const val RE_LOGIN = "reLogin" + const val USE_CHROME = "useChrome" + + @Inject + lateinit var impl: RouterManager - private fun buildPostcard(path: String): Postcard = ARouter.getInstance().build(path) + override fun go(url: String) { + impl.go(url) + } + + override fun goLogin(isReLogin: Boolean) { + impl.goLogin(isReLogin) + } + + override fun goMain() { + impl.goMain() + } + + override fun goAudioPlay() { + impl.goAudioPlay() + } + + override fun goWeb(url: String, useChrome: Boolean) { + impl.goWeb(url, useChrome) + } + } } diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt index 1aa34d18a..dbe30dbb8 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt @@ -3,7 +3,6 @@ package io.goooler.demoapp.common.router object RouterPath { const val LOGIN = "/login/" const val MAIN = "/main/" - const val MAP = "/map/" const val WEB = "/web/" const val AUDIO_PLAY = "/audioPlay/" } From 54fb028a1a7fb6396b78407f0b7a030ab7890fce Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 11:39:45 +0800 Subject: [PATCH 02/13] Add context param --- .../demoapp/common/router/RouterManager.kt | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt index 4edc6d8f2..24218ace6 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt @@ -1,18 +1,19 @@ package io.goooler.demoapp.common.router +import android.content.Context import javax.inject.Inject interface RouterManager { - fun go(url: String) + fun go(context: Context, url: String) - fun goLogin(isReLogin: Boolean) + fun goLogin(context: Context, isReLogin: Boolean) - fun goMain() + fun goMain(context: Context) - fun goAudioPlay() + fun goAudioPlay(context: Context) - fun goWeb(url: String, useChrome: Boolean = false) + fun goWeb(context: Context, url: String, useChrome: Boolean = false) companion object : RouterManager { const val PARAMS = "params" @@ -22,24 +23,24 @@ interface RouterManager { @Inject lateinit var impl: RouterManager - override fun go(url: String) { - impl.go(url) + override fun go(context: Context, url: String) { + impl.go(context, url) } - override fun goLogin(isReLogin: Boolean) { - impl.goLogin(isReLogin) + override fun goLogin(context: Context, isReLogin: Boolean) { + impl.goLogin(context, isReLogin) } - override fun goMain() { - impl.goMain() + override fun goMain(context: Context) { + impl.goMain(context) } - override fun goAudioPlay() { - impl.goAudioPlay() + override fun goAudioPlay(context: Context) { + impl.goAudioPlay(context) } - override fun goWeb(url: String, useChrome: Boolean) { - impl.goWeb(url, useChrome) + override fun goWeb(context: Context, url: String, useChrome: Boolean) { + impl.goWeb(context, url, useChrome) } } } From a5594883049e9f1c25115364f53547713a1881c6 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 11:48:06 +0800 Subject: [PATCH 03/13] Add RouterManagerImpl --- .../io/goooler/demoapp/RouterManagerImpl.kt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt new file mode 100644 index 000000000..539f5f465 --- /dev/null +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -0,0 +1,37 @@ +package io.goooler.demoapp + +import android.content.Context +import android.content.Intent +import io.goooler.demoapp.common.router.RouterManager +import io.goooler.demoapp.login.ui.LoginActivity +import io.goooler.demoapp.main.ui.AudioPlayActivity +import io.goooler.demoapp.main.ui.MainActivity +import io.goooler.demoapp.web.WebActivity + +object RouterManagerImpl : RouterManager { + override fun go(context: Context, url: String) {} + + override fun goLogin(context: Context, isReLogin: Boolean) { + Intent(context, LoginActivity::class.java) + .setAction(if (isReLogin) RouterManager.RE_LOGIN else null) + .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) + .let(context::startActivity) + } + + override fun goMain(context: Context) { + Intent(context, MainActivity::class.java) + .let(context::startActivity) + } + + override fun goAudioPlay(context: Context) { + Intent(context, AudioPlayActivity::class.java) + .let(context::startActivity) + } + + override fun goWeb(context: Context, url: String, useChrome: Boolean) { + Intent(context, WebActivity::class.java) + .putExtra(RouterManager.PARAMS, url) + .setAction(if (useChrome) RouterManager.USE_CHROME else null) + .let(context::startActivity) + } +} From 9fa7084e6158105e58afc0cd0bc5206f654f8bef Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 11:49:29 +0800 Subject: [PATCH 04/13] Remove ARouter --- build.gradle.kts | 7 ------- buildSrc/src/main/kotlin/Extensions.kt | 7 +++---- buildSrc/src/main/kotlin/Libs.kt | 5 ----- .../io/goooler/demoapp/common/CommonApplication.kt | 11 ----------- .../io/goooler/demoapp/login/ui/LoginActivity.kt | 3 --- .../io/goooler/demoapp/main/ui/AudioPlayActivity.kt | 3 --- .../kotlin/io/goooler/demoapp/main/ui/MainActivity.kt | 3 --- .../main/kotlin/io/goooler/demoapp/web/WebActivity.kt | 3 --- 8 files changed, 3 insertions(+), 39 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d0d746029..34e76375a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,6 @@ buildscript { rootProject.extra["androidPlugin"].toString(), rootProject.extra["kotlinPlugin"].toString(), Libs.hiltPlugin, - Libs.arouterPlugin, Libs.ktlintPlugin ) } @@ -42,12 +41,6 @@ allprojects { } } } - - tasks.matching { - it.name.contains("transformClassesWithCom.alibaba.arouter") - }.configureEach { - notCompatibleWithConfigurationCache("https://github.com/alibaba/ARouter/issues/984") - } } tasks { diff --git a/buildSrc/src/main/kotlin/Extensions.kt b/buildSrc/src/main/kotlin/Extensions.kt index ac6a769b6..96ddf5ab0 100644 --- a/buildSrc/src/main/kotlin/Extensions.kt +++ b/buildSrc/src/main/kotlin/Extensions.kt @@ -157,13 +157,12 @@ inline fun Project.setupCommon( create("online") } dependencies { - implementations(Libs.arouter, *Libs.hilt, *Libs.room, *Libs.moshi) - kapts(Libs.arouterCompiler, Libs.moshiCompiler, Libs.roomCompiler, Libs.hiltCompiler) + implementations(*Libs.hilt, *Libs.room, *Libs.moshi) + kapts(Libs.moshiCompiler, Libs.roomCompiler, Libs.hiltCompiler) } - applyPlugins(Plugins.kotlinParcelize, Plugins.arouter, Plugins.hilt) + applyPlugins(Plugins.kotlinParcelize, Plugins.hilt) kapt { arguments { - arg("AROUTER_MODULE_NAME", project.name) arg("room.incremental", "true") } } diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index 1b689d8cc..16a32b59f 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -1,7 +1,6 @@ @file:Suppress("SpellCheckingInspection") private const val retrofitVersion = "2.9.0" -private const val arouterVersion = "1.5.2" private const val moshiVersion = "1.13.0" private const val srlVersion = "2.0.3" private const val glideVersion = "4.13.0" @@ -27,7 +26,6 @@ object Plugins { const val androidLibrary = "com.android.library" const val androidApplication = "com.android.application" const val hilt = "dagger.hilt.android.plugin" - const val arouter = "com.alibaba.arouter" const val ktlint = "org.jlleitschuh.gradle.ktlint" } @@ -45,7 +43,6 @@ object Libs { const val cardView = "androidx.cardview:cardview:1.0.0" const val collection = "androidx.collection:collection-ktx:$collectionVersion" const val fastjson = "com.alibaba:fastjson:1.1.72.android" - const val arouter = "com.alibaba:arouter-api:$arouterVersion" const val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.8.1" const val flycoTabLayout = "com.flyco.tablayout:FlycoTabLayout_Lib:2.2.0" const val utils = "com.blankj:utilcodex:1.31.0" @@ -60,12 +57,10 @@ object Libs { const val chuckerDebug = "com.github.chuckerteam.chucker:library:$chuckerVersion" const val chuckerRelease = "com.github.chuckerteam.chucker:library-no-op:$chuckerVersion" - const val arouterPlugin = "com.alibaba:arouter-register:1.0.2" const val hiltPlugin = "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion" const val ktlintPlugin = "org.jlleitschuh.gradle:ktlint-gradle:10.2.1" const val roomCompiler = "androidx.room:room-compiler:$roomVersion" - const val arouterCompiler = "com.alibaba:arouter-compiler:$arouterVersion" const val moshiCompiler = "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion" const val hiltCompiler = "com.google.dagger:hilt-android-compiler:$hiltVersion" diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/CommonApplication.kt b/common/src/main/kotlin/io/goooler/demoapp/common/CommonApplication.kt index a1bcbf862..b5f2792de 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/CommonApplication.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/CommonApplication.kt @@ -1,14 +1,12 @@ package io.goooler.demoapp.common import android.webkit.WebView -import com.alibaba.android.arouter.launcher.ARouter import com.scwang.smart.refresh.footer.ClassicsFooter import com.scwang.smart.refresh.header.ClassicsHeader import com.scwang.smart.refresh.layout.SmartRefreshLayout import io.goooler.demoapp.base.core.BaseApplication import io.goooler.demoapp.common.util.CrashHandler import io.goooler.demoapp.common.util.ImageLoader -import io.goooler.demoapp.common.util.debugRun abstract class CommonApplication : BaseApplication() { @@ -16,20 +14,11 @@ abstract class CommonApplication : BaseApplication() { super.initImmediately() app = this CrashHandler.init() - initArouter() initImageLoader() initWebView() initSmartRefresh() } - private fun initArouter() { - debugRun { - ARouter.openLog() - ARouter.openDebug() - } - ARouter.init(this) - } - private fun initImageLoader() { ImageLoader.init(this) } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt index 6dc4c12ab..cef18e93c 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt @@ -1,13 +1,10 @@ package io.goooler.demoapp.login.ui import android.os.Bundle -import com.alibaba.android.arouter.facade.annotation.Route import io.goooler.demoapp.common.base.binding.BaseBindingActivity import io.goooler.demoapp.common.router.RouterManager -import io.goooler.demoapp.common.router.RouterPath import io.goooler.demoapp.login.databinding.LoginActivityBinding -@Route(path = RouterPath.LOGIN) class LoginActivity : BaseBindingActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt index 1674b6240..e73d7a399 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt @@ -2,16 +2,13 @@ package io.goooler.demoapp.main.ui import android.os.Bundle import android.view.View -import com.alibaba.android.arouter.facade.annotation.Route import io.goooler.demoapp.common.base.binding.BaseBindingActivity import io.goooler.demoapp.common.router.RouterManager -import io.goooler.demoapp.common.router.RouterPath import io.goooler.demoapp.common.service.AudioPlayService import io.goooler.demoapp.common.util.getString import io.goooler.demoapp.main.R import io.goooler.demoapp.main.databinding.MainAudioPlayActivityBinding -@Route(path = RouterPath.AUDIO_PLAY) class AudioPlayActivity : BaseBindingActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/MainActivity.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/MainActivity.kt index 666a65d06..115f2072d 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/MainActivity.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/MainActivity.kt @@ -3,13 +3,11 @@ package io.goooler.demoapp.main.ui import android.Manifest import android.content.Intent import android.os.Bundle -import com.alibaba.android.arouter.facade.annotation.Route import dagger.hilt.android.AndroidEntryPoint import io.goooler.demoapp.adapter.vp.CommonFragmentStatePagerAdapter import io.goooler.demoapp.base.util.PermissionHelper import io.goooler.demoapp.base.util.unsafeLazy import io.goooler.demoapp.common.base.binding.BaseBindingActivity -import io.goooler.demoapp.common.router.RouterPath import io.goooler.demoapp.common.util.log import io.goooler.demoapp.main.databinding.MainActivityBinding import io.goooler.demoapp.main.ui.fragment.MainHomeFragment @@ -17,7 +15,6 @@ import io.goooler.demoapp.main.ui.fragment.MainPagingFragment import io.goooler.demoapp.main.ui.fragment.MainSrlFragment @AndroidEntryPoint -@Route(path = RouterPath.MAIN) class MainActivity : BaseBindingActivity() { private val pagerAdapter by unsafeLazy { diff --git a/web/src/main/kotlin/io/goooler/demoapp/web/WebActivity.kt b/web/src/main/kotlin/io/goooler/demoapp/web/WebActivity.kt index 68592da31..143340b3f 100644 --- a/web/src/main/kotlin/io/goooler/demoapp/web/WebActivity.kt +++ b/web/src/main/kotlin/io/goooler/demoapp/web/WebActivity.kt @@ -5,15 +5,12 @@ import android.os.Bundle import android.view.View import androidx.browser.customtabs.CustomTabsIntent import androidx.core.net.toUri -import com.alibaba.android.arouter.facade.annotation.Route import com.blankj.utilcode.util.BarUtils import io.goooler.demoapp.base.util.addFragment import io.goooler.demoapp.common.base.binding.BaseBindingActivity import io.goooler.demoapp.common.router.RouterManager -import io.goooler.demoapp.common.router.RouterPath import io.goooler.demoapp.web.databinding.WebActivityBinding -@Route(path = RouterPath.WEB) class WebActivity : BaseBindingActivity() { private var webFragment: WebFragment? = null From 42f8016ec69284568803c15d816da3c47188f96a Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 11:53:20 +0800 Subject: [PATCH 05/13] Remove RouterPath --- .../main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt | 6 ++++++ .../kotlin/io/goooler/demoapp/common/router/RouterPath.kt | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt index 539f5f465..64d7dfab4 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -9,6 +9,12 @@ import io.goooler.demoapp.main.ui.MainActivity import io.goooler.demoapp.web.WebActivity object RouterManagerImpl : RouterManager { + + private const val LOGIN = "/login/" + private const val MAIN = "/main/" + private const val WEB = "/web/" + private const val AUDIO_PLAY = "/audioPlay/" + override fun go(context: Context, url: String) {} override fun goLogin(context: Context, isReLogin: Boolean) { diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt deleted file mode 100644 index dbe30dbb8..000000000 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterPath.kt +++ /dev/null @@ -1,8 +0,0 @@ -package io.goooler.demoapp.common.router - -object RouterPath { - const val LOGIN = "/login/" - const val MAIN = "/main/" - const val WEB = "/web/" - const val AUDIO_PLAY = "/audioPlay/" -} From 209b1ab6e17fed1c64dcf54701c63aac65f346e8 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 12:01:53 +0800 Subject: [PATCH 06/13] Add context params --- .../io/goooler/demoapp/common/network/RetrofitHelper.kt | 2 +- .../main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt | 2 +- .../kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt | 2 +- .../kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt | 2 +- .../io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt | 5 ++--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt index fa9024d15..3c3b2f301 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt @@ -28,7 +28,7 @@ object RetrofitHelper : BaseRetrofitHelper() { override val statusListener: StatusListener = StatusListener { AppUserInfoManager.logout() - RouterManager.goLogin(true) + RouterManager.goLogin(CommonApplication.app, true) } override fun Retrofit.Builder.addCallAdapterFactories(): Retrofit.Builder { diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt index cef18e93c..6b8b637ae 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt @@ -10,7 +10,7 @@ class LoginActivity : BaseBindingActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (intent.action != RouterManager.RE_LOGIN) { - RouterManager.goMain() + RouterManager.goMain(this) finish() } } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt index b8f73a456..9dda61947 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt @@ -9,7 +9,7 @@ class SplashActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - RouterManager.goMain() + RouterManager.goMain(this) overridePendingTransition(0, 0) finish() } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt index e73d7a399..0887db82c 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt @@ -33,7 +33,7 @@ class AudioPlayActivity : BaseBindingActivity() { AudioPlayService.stopPlay(this) } binding.btGoMain -> { - RouterManager.goMain() + RouterManager.goMain(this) } } } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt index 9931952ae..596de9694 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt @@ -40,11 +40,10 @@ class MainHomeFragment : BaseBindingLazyFragment() { private val listener = View.OnClickListener { when (it) { - binding.bt1 -> RouterManager.goWeb("bilibili.com") - binding.bt2 -> RouterManager.goMap() + binding.bt1 -> RouterManager.goWeb(requireContext(), "bilibili.com") binding.bt4 -> vm.countDown() binding.bt6 -> FullScreenDialogFragment.show(childFragmentManager) - binding.bt7 -> RouterManager.goAudioPlay() + binding.bt7 -> RouterManager.goAudioPlay(requireContext()) binding.bt8 -> createShortcut(requireContext()) } } From e3267fda1ce0a5e8c9bb11b883746bc25d7bced2 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 14:23:01 +0800 Subject: [PATCH 07/13] Add AppProviderModule to inject --- .../io/goooler/demoapp/AppProviderModule.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt diff --git a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt new file mode 100644 index 000000000..0abe7780b --- /dev/null +++ b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt @@ -0,0 +1,15 @@ +package io.goooler.demoapp + +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import io.goooler.demoapp.common.router.RouterManager + +@Module(includes = [RouterManager::class]) +@InstallIn(SingletonComponent::class) +object AppProviderModule { + + @Provides + fun provideRouterManagerImpl(): RouterManager = RouterManagerImpl +} From a1ad7acedced08b1362c0ae942e4bf18536b7eda Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 14:52:06 +0800 Subject: [PATCH 08/13] RouterManager.getInstance() --- .../io/goooler/demoapp/AppProviderModule.kt | 6 +-- .../io/goooler/demoapp/RouterManagerImpl.kt | 5 +- .../demoapp/common/network/RetrofitHelper.kt | 2 +- .../demoapp/common/router/RouterManager.kt | 53 ++++++++++--------- .../goooler/demoapp/login/ui/LoginActivity.kt | 2 +- .../demoapp/login/ui/SplashActivity.kt | 2 +- .../demoapp/main/ui/AudioPlayActivity.kt | 2 +- .../main/ui/fragment/MainHomeFragment.kt | 4 +- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt index 0abe7780b..24fae9c23 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt @@ -4,12 +4,12 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import io.goooler.demoapp.common.router.RouterManager +import io.goooler.demoapp.common.router.IRouterManager -@Module(includes = [RouterManager::class]) +@Module @InstallIn(SingletonComponent::class) object AppProviderModule { @Provides - fun provideRouterManagerImpl(): RouterManager = RouterManagerImpl + fun provideRouterManagerImpl(): IRouterManager = RouterManagerImpl } diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt index 64d7dfab4..492e11770 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -2,14 +2,15 @@ package io.goooler.demoapp import android.content.Context import android.content.Intent +import io.goooler.demoapp.common.router.IRouterManager import io.goooler.demoapp.common.router.RouterManager import io.goooler.demoapp.login.ui.LoginActivity import io.goooler.demoapp.main.ui.AudioPlayActivity import io.goooler.demoapp.main.ui.MainActivity import io.goooler.demoapp.web.WebActivity -object RouterManagerImpl : RouterManager { - +object RouterManagerImpl : IRouterManager { + private const val LOGIN = "/login/" private const val MAIN = "/main/" private const val WEB = "/web/" diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt index 3c3b2f301..7a6038da6 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt @@ -28,7 +28,7 @@ object RetrofitHelper : BaseRetrofitHelper() { override val statusListener: StatusListener = StatusListener { AppUserInfoManager.logout() - RouterManager.goLogin(CommonApplication.app, true) + RouterManager.getInstance().goLogin(CommonApplication.app, true) } override fun Retrofit.Builder.addCallAdapterFactories(): Retrofit.Builder { diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt index 24218ace6..7bd5f678f 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt @@ -3,44 +3,47 @@ package io.goooler.demoapp.common.router import android.content.Context import javax.inject.Inject -interface RouterManager { +class RouterManager : IRouterManager { + @Inject + lateinit var impl: IRouterManager - fun go(context: Context, url: String) + override fun go(context: Context, url: String) { + impl.go(context, url) + } - fun goLogin(context: Context, isReLogin: Boolean) + override fun goLogin(context: Context, isReLogin: Boolean) { + impl.goLogin(context, isReLogin) + } - fun goMain(context: Context) + override fun goMain(context: Context) { + impl.goMain(context) + } - fun goAudioPlay(context: Context) + override fun goAudioPlay(context: Context) { + impl.goAudioPlay(context) + } - fun goWeb(context: Context, url: String, useChrome: Boolean = false) + override fun goWeb(context: Context, url: String, useChrome: Boolean) { + impl.goWeb(context, url, useChrome) + } - companion object : RouterManager { + companion object { const val PARAMS = "params" const val RE_LOGIN = "reLogin" const val USE_CHROME = "useChrome" - @Inject - lateinit var impl: RouterManager + fun getInstance(): RouterManager = RouterManager() + } +} - override fun go(context: Context, url: String) { - impl.go(context, url) - } +interface IRouterManager { + fun go(context: Context, url: String) - override fun goLogin(context: Context, isReLogin: Boolean) { - impl.goLogin(context, isReLogin) - } + fun goLogin(context: Context, isReLogin: Boolean) - override fun goMain(context: Context) { - impl.goMain(context) - } + fun goMain(context: Context) - override fun goAudioPlay(context: Context) { - impl.goAudioPlay(context) - } + fun goAudioPlay(context: Context) - override fun goWeb(context: Context, url: String, useChrome: Boolean) { - impl.goWeb(context, url, useChrome) - } - } + fun goWeb(context: Context, url: String, useChrome: Boolean = false) } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt index 6b8b637ae..5f69120b9 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt @@ -10,7 +10,7 @@ class LoginActivity : BaseBindingActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (intent.action != RouterManager.RE_LOGIN) { - RouterManager.goMain(this) + RouterManager.getInstance().goMain(this) finish() } } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt index 9dda61947..9ed093ac0 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt @@ -9,7 +9,7 @@ class SplashActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - RouterManager.goMain(this) + RouterManager.getInstance().goMain(this) overridePendingTransition(0, 0) finish() } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt index 0887db82c..f2ac847f3 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt @@ -33,7 +33,7 @@ class AudioPlayActivity : BaseBindingActivity() { AudioPlayService.stopPlay(this) } binding.btGoMain -> { - RouterManager.goMain(this) + RouterManager.getInstance().goMain(this) } } } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt index 596de9694..20e396b76 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt @@ -40,10 +40,10 @@ class MainHomeFragment : BaseBindingLazyFragment() { private val listener = View.OnClickListener { when (it) { - binding.bt1 -> RouterManager.goWeb(requireContext(), "bilibili.com") + binding.bt1 -> RouterManager.getInstance().goWeb(requireContext(), "bilibili.com") binding.bt4 -> vm.countDown() binding.bt6 -> FullScreenDialogFragment.show(childFragmentManager) - binding.bt7 -> RouterManager.goAudioPlay(requireContext()) + binding.bt7 -> RouterManager.getInstance().goAudioPlay(requireContext()) binding.bt8 -> createShortcut(requireContext()) } } From 642cda548b343a30214155e174742e588ac2bf4e Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 16:02:24 +0800 Subject: [PATCH 09/13] Revert "RouterManager.getInstance()" This reverts commit a1ad7ace --- .../io/goooler/demoapp/AppProviderModule.kt | 6 +-- .../io/goooler/demoapp/RouterManagerImpl.kt | 5 +- .../demoapp/common/network/RetrofitHelper.kt | 2 +- .../demoapp/common/router/RouterManager.kt | 53 +++++++++---------- .../goooler/demoapp/login/ui/LoginActivity.kt | 2 +- .../demoapp/login/ui/SplashActivity.kt | 2 +- .../demoapp/main/ui/AudioPlayActivity.kt | 2 +- .../main/ui/fragment/MainHomeFragment.kt | 4 +- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt index 24fae9c23..0abe7780b 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt @@ -4,12 +4,12 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import io.goooler.demoapp.common.router.IRouterManager +import io.goooler.demoapp.common.router.RouterManager -@Module +@Module(includes = [RouterManager::class]) @InstallIn(SingletonComponent::class) object AppProviderModule { @Provides - fun provideRouterManagerImpl(): IRouterManager = RouterManagerImpl + fun provideRouterManagerImpl(): RouterManager = RouterManagerImpl } diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt index 492e11770..64d7dfab4 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -2,15 +2,14 @@ package io.goooler.demoapp import android.content.Context import android.content.Intent -import io.goooler.demoapp.common.router.IRouterManager import io.goooler.demoapp.common.router.RouterManager import io.goooler.demoapp.login.ui.LoginActivity import io.goooler.demoapp.main.ui.AudioPlayActivity import io.goooler.demoapp.main.ui.MainActivity import io.goooler.demoapp.web.WebActivity -object RouterManagerImpl : IRouterManager { - +object RouterManagerImpl : RouterManager { + private const val LOGIN = "/login/" private const val MAIN = "/main/" private const val WEB = "/web/" diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt index 7a6038da6..3c3b2f301 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/network/RetrofitHelper.kt @@ -28,7 +28,7 @@ object RetrofitHelper : BaseRetrofitHelper() { override val statusListener: StatusListener = StatusListener { AppUserInfoManager.logout() - RouterManager.getInstance().goLogin(CommonApplication.app, true) + RouterManager.goLogin(CommonApplication.app, true) } override fun Retrofit.Builder.addCallAdapterFactories(): Retrofit.Builder { diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt index 7bd5f678f..24218ace6 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt @@ -3,47 +3,44 @@ package io.goooler.demoapp.common.router import android.content.Context import javax.inject.Inject -class RouterManager : IRouterManager { - @Inject - lateinit var impl: IRouterManager +interface RouterManager { - override fun go(context: Context, url: String) { - impl.go(context, url) - } + fun go(context: Context, url: String) - override fun goLogin(context: Context, isReLogin: Boolean) { - impl.goLogin(context, isReLogin) - } + fun goLogin(context: Context, isReLogin: Boolean) - override fun goMain(context: Context) { - impl.goMain(context) - } + fun goMain(context: Context) - override fun goAudioPlay(context: Context) { - impl.goAudioPlay(context) - } + fun goAudioPlay(context: Context) - override fun goWeb(context: Context, url: String, useChrome: Boolean) { - impl.goWeb(context, url, useChrome) - } + fun goWeb(context: Context, url: String, useChrome: Boolean = false) - companion object { + companion object : RouterManager { const val PARAMS = "params" const val RE_LOGIN = "reLogin" const val USE_CHROME = "useChrome" - fun getInstance(): RouterManager = RouterManager() - } -} + @Inject + lateinit var impl: RouterManager -interface IRouterManager { - fun go(context: Context, url: String) + override fun go(context: Context, url: String) { + impl.go(context, url) + } - fun goLogin(context: Context, isReLogin: Boolean) + override fun goLogin(context: Context, isReLogin: Boolean) { + impl.goLogin(context, isReLogin) + } - fun goMain(context: Context) + override fun goMain(context: Context) { + impl.goMain(context) + } - fun goAudioPlay(context: Context) + override fun goAudioPlay(context: Context) { + impl.goAudioPlay(context) + } - fun goWeb(context: Context, url: String, useChrome: Boolean = false) + override fun goWeb(context: Context, url: String, useChrome: Boolean) { + impl.goWeb(context, url, useChrome) + } + } } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt index 5f69120b9..6b8b637ae 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/LoginActivity.kt @@ -10,7 +10,7 @@ class LoginActivity : BaseBindingActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (intent.action != RouterManager.RE_LOGIN) { - RouterManager.getInstance().goMain(this) + RouterManager.goMain(this) finish() } } diff --git a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt index 9ed093ac0..9dda61947 100644 --- a/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt +++ b/login/src/main/kotlin/io/goooler/demoapp/login/ui/SplashActivity.kt @@ -9,7 +9,7 @@ class SplashActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - RouterManager.getInstance().goMain(this) + RouterManager.goMain(this) overridePendingTransition(0, 0) finish() } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt index f2ac847f3..0887db82c 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/AudioPlayActivity.kt @@ -33,7 +33,7 @@ class AudioPlayActivity : BaseBindingActivity() { AudioPlayService.stopPlay(this) } binding.btGoMain -> { - RouterManager.getInstance().goMain(this) + RouterManager.goMain(this) } } } diff --git a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt index 20e396b76..596de9694 100644 --- a/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt +++ b/main/src/main/kotlin/io/goooler/demoapp/main/ui/fragment/MainHomeFragment.kt @@ -40,10 +40,10 @@ class MainHomeFragment : BaseBindingLazyFragment() { private val listener = View.OnClickListener { when (it) { - binding.bt1 -> RouterManager.getInstance().goWeb(requireContext(), "bilibili.com") + binding.bt1 -> RouterManager.goWeb(requireContext(), "bilibili.com") binding.bt4 -> vm.countDown() binding.bt6 -> FullScreenDialogFragment.show(childFragmentManager) - binding.bt7 -> RouterManager.getInstance().goAudioPlay(requireContext()) + binding.bt7 -> RouterManager.goAudioPlay(requireContext()) binding.bt8 -> createShortcut(requireContext()) } } From 908a4347afdc5ddfcf77044ce0b7ac8446f4df3c Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 16:02:26 +0800 Subject: [PATCH 10/13] Revert "Add AppProviderModule to inject" This reverts commit e3267fda --- .../io/goooler/demoapp/AppProviderModule.kt | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt diff --git a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt b/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt deleted file mode 100644 index 0abe7780b..000000000 --- a/app/src/main/kotlin/io/goooler/demoapp/AppProviderModule.kt +++ /dev/null @@ -1,15 +0,0 @@ -package io.goooler.demoapp - -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import io.goooler.demoapp.common.router.RouterManager - -@Module(includes = [RouterManager::class]) -@InstallIn(SingletonComponent::class) -object AppProviderModule { - - @Provides - fun provideRouterManagerImpl(): RouterManager = RouterManagerImpl -} From 335c55af69300c668837480ed1d372d6da11df55 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 16:04:32 +0800 Subject: [PATCH 11/13] Inject RouterManager.impl in DemoApplication --- .../main/kotlin/io/goooler/demoapp/DemoApplication.kt | 9 ++++++++- .../main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt | 2 +- .../io/goooler/demoapp/common/router/RouterManager.kt | 2 -- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/io/goooler/demoapp/DemoApplication.kt b/app/src/main/kotlin/io/goooler/demoapp/DemoApplication.kt index ed020ed45..056d72fc1 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/DemoApplication.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/DemoApplication.kt @@ -2,6 +2,13 @@ package io.goooler.demoapp import dagger.hilt.android.HiltAndroidApp import io.goooler.demoapp.common.CommonApplication +import io.goooler.demoapp.common.router.RouterManager @HiltAndroidApp -class DemoApplication : CommonApplication() +class DemoApplication : CommonApplication() { + + override fun initImmediately() { + super.initImmediately() + RouterManager.impl = RouterManagerImpl + } +} diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt index 64d7dfab4..d3d8b280b 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -9,7 +9,7 @@ import io.goooler.demoapp.main.ui.MainActivity import io.goooler.demoapp.web.WebActivity object RouterManagerImpl : RouterManager { - + private const val LOGIN = "/login/" private const val MAIN = "/main/" private const val WEB = "/web/" diff --git a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt index 24218ace6..8867997da 100644 --- a/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt +++ b/common/src/main/kotlin/io/goooler/demoapp/common/router/RouterManager.kt @@ -1,7 +1,6 @@ package io.goooler.demoapp.common.router import android.content.Context -import javax.inject.Inject interface RouterManager { @@ -20,7 +19,6 @@ interface RouterManager { const val RE_LOGIN = "reLogin" const val USE_CHROME = "useChrome" - @Inject lateinit var impl: RouterManager override fun go(context: Context, url: String) { From c8901beedad67ba03291e91e96fd901fcf8b9dc4 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 16:06:08 +0800 Subject: [PATCH 12/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8a984ceb..d1603580f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ - [x] [Chucker](https://github.com/ChuckerTeam/chucker/releases) - [x] [Coil](https://github.com/coil-kt/coil/releases) - [x] [Glide](https://github.com/bumptech/glide/releases) -- [x] [ARouter](https://github.com/alibaba/ARouter/releases) +- [ ] [ARouter](https://github.com/alibaba/ARouter/releases) - [x] [FastJson](https://github.com/alibaba/fastjson) - [x] [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode/releases) - [x] [PermissionX](https://github.com/guolindev/PermissionX) From 39760db0d856b31e31c838f6312544d4ea144ab2 Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 11 Feb 2022 16:24:56 +0800 Subject: [PATCH 13/13] Add todo --- app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt index d3d8b280b..83980119f 100644 --- a/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt +++ b/app/src/main/kotlin/io/goooler/demoapp/RouterManagerImpl.kt @@ -15,7 +15,9 @@ object RouterManagerImpl : RouterManager { private const val WEB = "/web/" private const val AUDIO_PLAY = "/audioPlay/" - override fun go(context: Context, url: String) {} + override fun go(context: Context, url: String) { + TODO("Not yet implemented") + } override fun goLogin(context: Context, isReLogin: Boolean) { Intent(context, LoginActivity::class.java)