feat: 增加kotlin支持,升级依赖到最新版
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
static def appName() {
|
||||
return "TTStdElderlyDialer"
|
||||
@@ -11,15 +13,15 @@ static def releaseTime() {
|
||||
android {
|
||||
namespace "com.ttstd.dialer"
|
||||
|
||||
compileSdkVersion 33
|
||||
compileSdkVersion 37
|
||||
// buildToolsVersion "36.0.0"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.ttstd.dialer"
|
||||
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 33
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 37
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -77,6 +79,11 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// 添加 Kotlin 编译选项
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
dataBinding true
|
||||
buildConfig true
|
||||
@@ -186,59 +193,61 @@ dependencies {
|
||||
implementation project(path: ':niceimageview')
|
||||
implementation project(path: ':iconloader')
|
||||
|
||||
// 添加 Kotlin 标准库
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.2.10"
|
||||
// 添加这行,使用 BOM 统一 Kotlin 相关库的版本
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.2.10"))
|
||||
|
||||
//保持1.3.1 更新会报错
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||
//2.0.4以上无法预览
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation "androidx.multidex:multidex:2.0.1"
|
||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||
implementation "androidx.recyclerview:recyclerview:1.4.0"
|
||||
// For control over item selection of both touch and mouse driven selection
|
||||
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
|
||||
implementation "androidx.recyclerview:recyclerview-selection:1.2.0"
|
||||
// Java language implementation
|
||||
implementation "androidx.fragment:fragment:1.4.1"
|
||||
implementation "androidx.viewpager2:viewpager2:1.0.0"
|
||||
implementation "androidx.fragment:fragment:1.8.9"
|
||||
implementation "androidx.viewpager2:viewpager2:1.1.0"
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
// Room依赖
|
||||
implementation "androidx.room:room-runtime:2.3.0"
|
||||
implementation "androidx.room:room-rxjava3:2.3.0"
|
||||
annotationProcessor "androidx.room:room-compiler:2.3.0"
|
||||
implementation "androidx.room:room-runtime:2.8.4"
|
||||
implementation "androidx.room:room-rxjava3:2.8.4"
|
||||
kapt "androidx.room:room-compiler:2.8.4"
|
||||
// ViewModel和LiveData
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel:2.3.0"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata:2.3.0"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime:2.3.0"
|
||||
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.3.0"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel:2.10.0"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata:2.10.0"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime:2.10.0"
|
||||
kapt "androidx.lifecycle:lifecycle-compiler:2.10.0"
|
||||
// LifecycleService 核心库
|
||||
implementation "androidx.lifecycle:lifecycle-service:2.3.0"
|
||||
implementation "androidx.lifecycle:lifecycle-service:2.10.0"
|
||||
|
||||
// 添加这行,使用 BOM 统一 Kotlin 相关库的版本
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.10"))
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
|
||||
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.13.0'
|
||||
//glide
|
||||
implementation 'com.github.bumptech.glide:glide:4.13.1'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.15.1'
|
||||
kapt 'com.github.bumptech.glide:compiler:4.15.1'
|
||||
// SVG支持库f
|
||||
implementation 'com.caverock:androidsvg:1.4'
|
||||
// 如果需要,添加Glide SVG模块(社区版)
|
||||
// implementation 'com.github.qoqa:glide-svg:2.0.4'
|
||||
|
||||
//RxJava
|
||||
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
|
||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||
implementation 'io.reactivex.rxjava3:rxjava:3.1.12'
|
||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
|
||||
//
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.3.2'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:5.3.2'
|
||||
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:3.0.0"
|
||||
//Gson
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation 'com.google.zxing:core:3.5.0'
|
||||
implementation 'com.google.code.gson:gson:2.14.0'
|
||||
implementation 'com.google.zxing:core:3.5.4'
|
||||
//生命周期管理
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
|
||||
@@ -253,15 +262,15 @@ dependencies {
|
||||
|
||||
implementation 'com.facebook.rebound:rebound:0.3.8'
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.14'
|
||||
implementation 'com.tencent:mmkv-static:2.4.0'
|
||||
//bugly
|
||||
implementation 'com.tencent.bugly:crashreport:4.1.9.3'
|
||||
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
|
||||
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.1.0'
|
||||
|
||||
// 替换成最新版本, 需要注意的是api
|
||||
// 要与compiler匹配使用,均使用最新版可以保证兼容
|
||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
kapt 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
//推送
|
||||
//阿里云
|
||||
@@ -317,15 +326,15 @@ dependencies {
|
||||
//指示器
|
||||
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
|
||||
//工具类
|
||||
implementation 'com.blankj:utilcodex:1.31.0'
|
||||
implementation 'com.blankj:utilcodex:1.31.1'
|
||||
//aria
|
||||
implementation 'com.arialyy.aria:core:3.8.15'
|
||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||
kapt 'com.arialyy.aria:compiler:3.8.15'
|
||||
//状态栏透明
|
||||
implementation 'com.gitee.zackratos:UltimateBarX:0.8.0'
|
||||
//指示器
|
||||
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
|
||||
implementation 'com.opencsv:opencsv:5.5.2'
|
||||
implementation 'com.opencsv:opencsv:5.12.0'
|
||||
|
||||
// 吐司框架:https://github.com/getActivity/Toaster
|
||||
implementation 'com.github.getActivity:Toaster:12.6'
|
||||
|
||||
35
app/src/main/java/com/ttstd/dialer/utils/KotlinUtils.kt
Normal file
35
app/src/main/java/com/ttstd/dialer/utils/KotlinUtils.kt
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.ttstd.dialer.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
|
||||
class KotlinUtils {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DialerUtils"
|
||||
|
||||
/**
|
||||
* 拨打电话
|
||||
* @param context 上下文
|
||||
* @param phoneNumber 电话号码
|
||||
*/
|
||||
@JvmStatic
|
||||
fun makeCall(context: Context, phoneNumber: String) {
|
||||
try {
|
||||
val intent = Intent(Intent.ACTION_CALL).apply {
|
||||
data = Uri.parse("tel:$phoneNumber")
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
context.startActivity(intent)
|
||||
Log.d(TAG, "正在拨打: $phoneNumber")
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "没有打电话权限", e)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "拨打电话失败", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user