Modify: 剔除Hilt(不支持组件化)

This commit is contained in:
Quyunshuo
2020-08-28 10:38:48 +08:00
parent f3a559dd78
commit f9479e9242
11 changed files with 15 additions and 66 deletions

View File

@ -4,7 +4,6 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
android {
compileSdkVersion BuildConfig.compileSdkVersion
@ -57,8 +56,6 @@ dependencies {
api JetPack.LifecycleRuntimeKtx
api JetPack.LifecycleViewModel
api JetPack.LifecycleViewModelKtx
api JetPack.HiltLifecycleViewModel
api JetPack.HiltDaggerAndroid
api GitHub.OkHttp
api GitHub.OkHttpInterceptorLogging
@ -71,8 +68,6 @@ dependencies {
api GitHub.ARoute
api GitHub.RecyclerViewAdapter
kapt JetPack.HiltDaggerCompiler
kapt JetPack.Hilt
kapt GitHub.GlideCompiler
kapt GitHub.ARouteCompiler
}

View File

@ -18,6 +18,7 @@ abstract class BaseFrameActivity<VB : ViewBinding> : AppCompatActivity() {
super.onCreate(savedInstanceState)
mBinding = initViewBinding()
setContentView(mBinding.root)
initView()
}
protected abstract fun initViewBinding(): VB

View File

@ -4,7 +4,6 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
android {
compileSdkVersion BuildConfig.compileSdkVersion
@ -42,9 +41,6 @@ dependencies {
api project(path: ':Lib_Base')
implementation JetPack.HiltDaggerAndroid
kapt JetPack.HiltDaggerCompiler
kapt JetPack.Hilt
kapt GitHub.GlideCompiler
kapt GitHub.ARouteCompiler
}

View File

@ -1,24 +0,0 @@
package com.quyunshuo.common
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.quyunshuo.common.test", appContext.packageName)
}
}

View File

@ -1,17 +0,0 @@
package com.quyunshuo.common
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@ -3,7 +3,7 @@
package="com.quyunshuo.main">
<application
android:name="com.quyunshuo.common.CommonApplication"
android:name="debug.MainApplication"
android:allowBackup="true"
android:label="@string/main_app_name"
android:theme="@style/base_AppTheme">

View File

@ -0,0 +1,11 @@
package debug
import com.quyunshuo.common.CommonApplication
/**
* @Author: QuYunShuo
* @Time: 2020/8/28
* @Class: MainApplication
* @Remark: 作为app模式时的Application
*/
class MainApplication : CommonApplication()

View File

@ -10,7 +10,6 @@ buildscript {
dependencies {
classpath ProjectPluginManager.AndroidToolsPlugin
classpath ProjectPluginManager.KotlinPlugin
classpath ProjectPluginManager.DaggerHiltPlugin
}
}

View File

@ -25,9 +25,6 @@ object Version {
const val LifecycleViewModel = "2.2.0"
const val LifecycleRuntimeKtx = "2.2.0"
const val LifecycleViewModelKtx = "2.2.0"
const val Hilt = "1.0.0-alpha02" // Hilt 依赖注入
const val HiltLifecycleViewModel = "1.0.0-alpha02"
const val HiltDagger = "2.28-alpha"
// GitHub----------------------------------------------------------------
const val OkHttp = "3.14.9" // OkHttp
@ -67,12 +64,6 @@ object JetPack {
"androidx.lifecycle:lifecycle-runtime-ktx:${Version.LifecycleRuntimeKtx}"
const val LifecycleViewModelKtx =
"androidx.lifecycle:lifecycle-viewmodel-ktx:${Version.LifecycleViewModelKtx}"
const val Hilt = "androidx.hilt:hilt-compiler:${Version.Hilt}"
const val HiltLifecycleViewModel =
"androidx.hilt:hilt-lifecycle-viewmodel:${Version.HiltLifecycleViewModel}"
const val HiltDaggerAndroid = "com.google.dagger:hilt-android:${Version.HiltDagger}"
const val HiltDaggerCompiler =
"com.google.dagger:hilt-android-compiler:${Version.HiltDagger}"
}
object Kotlin {

View File

@ -6,5 +6,4 @@ package com.quyunshuo.androidbaseframemvvm.build
object ProjectPluginManager {
const val AndroidToolsPlugin = "com.android.tools.build:gradle:4.0.1"
const val KotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
const val DaggerHiltPlugin = "com.google.dagger:hilt-android-gradle-plugin:2.28.1-alpha"
}

View File

@ -8,7 +8,6 @@ if (BuildConfig.isAppMode) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
android {
compileSdkVersion BuildConfig.compileSdkVersion
@ -76,7 +75,6 @@ dependencies {
testImplementation Android.Junit
androidTestImplementation AndroidX.TestExtJunit
androidTestImplementation AndroidX.TestEspresso
implementation JetPack.HiltDaggerAndroid
kapt JetPack.HiltDaggerCompiler
kapt JetPack.Hilt
kapt GitHub.GlideCompiler
kapt GitHub.ARouteCompiler
}