From 8ef7ebdebf0786680b390b90ce50d13fa6b52b4e Mon Sep 17 00:00:00 2001 From: yimiao Date: Tue, 30 Nov 2021 16:08:52 +0800 Subject: [PATCH] =?UTF-8?q?[desc]:=E6=8A=BD=E8=B1=A1=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20[author]:wangyimiao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 22 +------------------ buildCommon/commonLibConfig.gradle | 17 +++++++++++++- commonbt/build.gradle | 2 ++ .../java/com/common/bluetooth/BtManager.kt | 7 +++--- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8350a40..862232e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,25 +1,10 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' -} - apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle" +project.ext.setAppDefaultConfig project project.ext.setArouterConfig project android { - compileSdkVersion rootProject.ext.versions.compileSdkVersion - buildToolsVersion rootProject.ext.versions.buildToolsVersion - defaultConfig { applicationId "com.common.commonlibtest" - minSdkVersion rootProject.ext.versions.minSdkVersion - targetSdkVersion rootProject.ext.versions.targetSdkVersion - versionCode rootProject.ext.versions.versionCode - versionName rootProject.ext.versions.versionName - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { @@ -43,13 +28,8 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } buildFeatures { - dataBinding true viewBinding true } } diff --git a/buildCommon/commonLibConfig.gradle b/buildCommon/commonLibConfig.gradle index 61743b7..f3d3808 100644 --- a/buildCommon/commonLibConfig.gradle +++ b/buildCommon/commonLibConfig.gradle @@ -103,7 +103,7 @@ project.ext { } /** - * android library default config + * android library config */ setLibDefaultConfig = { extension -> @@ -117,6 +117,21 @@ project.ext { setDependencies extension.dependencies } + /** + * android application config + */ + setAppDefaultConfig = { + extension -> + extension.apply plugin: 'com.android.application' + extension.apply plugin: 'kotlin-android' + extension.apply plugin: 'kotlin-parcelize' + extension.apply plugin: 'kotlin-kapt' + extension.description "lib" + + setAndroidConfig extension.android + setDependencies extension.dependencies + } + /** * android library common config */ diff --git a/commonbt/build.gradle b/commonbt/build.gradle index 5fe86e0..b2aa365 100644 --- a/commonbt/build.gradle +++ b/commonbt/build.gradle @@ -21,4 +21,6 @@ dependencies { // 添加kotlin依赖 implementation rootProject.ext.dependencies.kotlin + // 添加rxAndroid依赖 + implementation rootProject.ext.dependencies.rxandroid } \ No newline at end of file diff --git a/commonbt/src/main/java/com/common/bluetooth/BtManager.kt b/commonbt/src/main/java/com/common/bluetooth/BtManager.kt index 11af4b9..af1e96e 100644 --- a/commonbt/src/main/java/com/common/bluetooth/BtManager.kt +++ b/commonbt/src/main/java/com/common/bluetooth/BtManager.kt @@ -25,10 +25,9 @@ import com.common.bluetooth.service.BLEClientService.BLEClientBinder import com.common.bluetooth.service.BLEReceiveService import com.common.bluetooth.service.BLEReceiveService.ReceiverBinder import com.common.bluetooth.service.BluetoothLeClient -import io.reactivex.Observer -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.Disposable -import java.nio.charset.Charset +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.core.Observer +import io.reactivex.rxjava3.disposables.Disposable import java.util.concurrent.atomic.AtomicBoolean /**