plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-android'
    id 'kotlin-parcelize' // 序列化
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin' //hilt 依赖注入
    id "com.google.protobuf" version "0.8.17" //Proto DataStore 插件
    id 'androidx.navigation.safeargs.kotlin'//Safe Args传递数据
//    id 'com.google.dagger.hilt.android'
}


//apply plugin: 'realm-android'
android {
    namespace 'com.navinfo.volvo'
    compileSdk 32

    defaultConfig {
        applicationId "com.navinfo.volvo"
        minSdk 24
        targetSdk 32
        versionCode 1
        versionName "1.1"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        // 指定room.schemaLocation生成的文件路径
        javaCompileOptions {
            annotationProcessorOptions {
                arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
        ndk {
            abiFilters "armeabi", "armeabi-v7a"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
        freeCompilerArgs += [
                "-Xjvm-default=all",
        ]
    }
    buildFeatures {
        viewBinding true
        dataBinding true
    }

}

dependencies {
    def nav_version = "2.5.3"
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation "androidx.compose.material3:material3:1.0.0-alpha04"

    //布局
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

    //生命周期
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1"

    //导航  // Kotlin
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"


    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

    //room 数据库相关
    implementation 'com.tencent.wcdb:room:1.1-19'  // 代替 room-runtime,同时也不需要再引用 wcdb-android
    implementation 'androidx.sqlite:sqlite-ktx:2.2.0'
    implementation 'androidx.room:room-runtime:2.4.3'
    implementation 'androidx.room:room-ktx:2.4.3'
    annotationProcessor 'androidx.room:room-compiler:2.4.3'
    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
    kapt 'android.arch.persistence.room:compiler:1.1.1'// compiler 需要用 room 的
    kapt 'androidx.room:room-compiler:2.4.3'
    kapt 'androidx.room:room-ktx:2.4.3'

    //分页加载
    implementation "androidx.room:room-paging:2.4.3"
    implementation "androidx.paging:paging-runtime-ktx:3.1.1"

    androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
    implementation 'com.tencent.wcdb:wcdb-android:1.1-19'


    // 文件选择器 https://github.com/rosuH/AndroidFilePicker/blob/master/README_CN.md
    implementation 'me.rosuh:AndroidFilePicker:0.8.2'
//    // 时间选择器 https://github.com/Gredicer/datetimepicker
//    implementation 'com.github.Gredicer:datetimepicker:V1.0.0'
    implementation project(path: ':datetimepicker')

    //带侧滑的自定义列表
    implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
    //下拉刷新,上拉加载
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

    // Retrofit 网络请求相关
    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:converter-gson:2.9.0")
    implementation("com.squareup.okhttp3:okhttp:4.9.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")
    implementation("com.google.code.gson:gson:2.8.6")

    //hilt
    implementation "com.google.dagger:hilt-android:2.41"
    kapt "com.google.dagger:hilt-compiler:2.41"

    // 显示错误提示 https://github.com/nhaarman/supertooltips
    implementation 'com.nhaarman.supertooltips:library:3.0.0'

    // 权限请求框架:https://github.com/getActivity/XXPermissions
    implementation 'com.github.getActivity:XXPermissions:16.5'

    // 相机库 https://natario1.github.io/CameraView/about/getting-started
    implementation("com.otaliastudios:cameraview:2.7.2")
    // 图片压缩算法 https://github.com/Curzibn/Luban
    implementation 'top.zibin:Luban:1.1.8'
    // Android工具类库 https://github.com/gycold/EasyAndroid
    implementation 'io.github.gycold:easyandroid:2.0.7'
    // 日志工具 https://github.com/elvishew/xLog/blob/master/README_ZH.md
    implementation 'com.elvishew:xlog:1.10.1'
    //加载图片的依赖包
    implementation("com.github.bumptech.glide:glide:4.11.0") {
        exclude group: "com.android.support"
    }
    // 多媒体播放库 https://github.com/JagarYousef/ChatVoicePlayer
    implementation 'com.github.JagarYousef:ChatVoicePlayer:1.1.0'
    // 图片查看器 https://github.com/XiaoGe-1996/ImageViewer
    implementation 'com.github.XiaoGe-1996:ImageViewer:v1.0.0'
    implementation 'com.github.majidarabi:AndroidFilePicker:0.2.1'
    // 数据存储 Preferences DataStore 键值对
    implementation "androidx.datastore:datastore-preferences:1.0.0"
    // 数据存储 Proto DataStore 对象
    implementation "androidx.datastore:datastore-core:1.0.0"
    implementation  "com.google.protobuf:protobuf-javalite:3.18.0"
}

//Proto DataStore 数据存储插件
protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:3.14.0"
    }
    // Generates the java Protobuf-lite code for the Protobufs in this project. See
    // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
    // for more information.
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option 'lite'
                }
            }
        }
    }
}

kapt {
    correctErrorTypes true
}