Modify: 添加Common项目相关公共组件

This commit is contained in:
Quyunshuo
2020-08-27 17:08:52 +08:00
parent 6f267b7005
commit 478e9ffd2f
21 changed files with 161 additions and 26 deletions

1
Lib_Common/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

50
Lib_Common/build.gradle Normal file
View File

@ -0,0 +1,50 @@
import com.quyunshuo.androidbaseframemvvm.build.*
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
buildToolsVersion BuildConfig.buildToolsVersion
defaultConfig {
minSdkVersion BuildConfig.minSdkVersion
targetSdkVersion BuildConfig.targetSdkVersion
versionCode BuildConfig.versionCode
versionName BuildConfig.versionName
testInstrumentationRunner AndroidX.AndroidJUnitRunner
consumerProguardFiles "consumer-rules.pro"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
resourcePrefix "common_"
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
api project(path: ':Lib_Base')
implementation JetPack.HiltDaggerAndroid
kapt JetPack.HiltDaggerCompiler
kapt JetPack.Hilt
kapt GitHub.GlideCompiler
kapt GitHub.ARouteCompiler
}

View File

21
Lib_Common/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,24 @@
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

@ -0,0 +1 @@
<manifest package="com.quyunshuo.common" />

View File

@ -0,0 +1,12 @@
package com.quyunshuo.common
import com.quyunshuo.base.BaseApplication
/**
* @Author: QuYunShuo
* @Time: 2020/8/27
* @Class: CommonApplication
* @Remark: 项目相关的Application
*/
open class CommonApplication : BaseApplication() {
}

View File

@ -0,0 +1,17 @@
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)
}
}