plugins {
    id 'com.android.application'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.ellison.jetpackdemo"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }

    viewBinding {
        enabled = true
    }

    dataBinding {
        enabled = true
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    // appcompat
    implementation 'androidx.appcompat:appcompat:1.2.0'
    // lifecycle
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01'

    // material
    implementation 'com.google.android.material:material:1.1.0'

    // constraint layout
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    // test
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // CameraX
    def camerax_version = "1.1.0-alpha05" // 1.0.0-rc01
    // The following line is optional, as the core library is included indirectly by camera-camera2
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    // If you want to additionally use the CameraX Lifecycle library
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"

    def camerax_extensions_version = "1.0.0-alpha25" // 1.0.0-alpha24
    // If you want to additionally use the CameraX View class
    implementation "androidx.camera:camera-view:${camerax_extensions_version}"
    // If you want to additionally use the CameraX Extensions library
    implementation "androidx.camera:camera-extensions:${camerax_extensions_version}"

    // parse qr code
    implementation 'com.google.zxing:core:3.3.2'

    // kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // room
    def room_version = "2.2.6"
    implementation "androidx.room:room-runtime:$room_version"

    // for java
    annotationProcessor "androidx.room:room-compiler:$room_version"
    // optional - RxJava support for Room
    implementation "androidx.room:room-rxjava2:$room_version"
    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"
    // optional - Test helpers
    testImplementation "androidx.room:room-testing:$room_version"

    // for kotlin
    kapt "androidx.room:room-compiler:$room_version"
    // optional - Kotlin Extensions and Coroutines support for Room
    // optional - Test helpers
    testImplementation "androidx.room:room-testing:$room_version"
    // coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'

    // kotlin ktx
    implementation "androidx.core:core-ktx:1.3.2"
    // viewmodel
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    // lifecycle
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
    // livedata
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
    // room
    implementation "androidx.room:room-ktx:$room_version"
    // fragment
    implementation 'androidx.fragment:fragment-ktx:1.2.2'

    // dagger
    implementation 'com.google.dagger:dagger:2.33'
    kapt 'com.google.dagger:dagger-compiler:2.33'

    // retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
    // gson
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

    // hilt
    def dagger_hilt_version = "2.28-alpha"
    implementation "com.google.dagger:hilt-android:$dagger_hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$dagger_hilt_version"
    // kapt "com.google.dagger:hilt-compiler:$dagger_hilt_version"

    def android_hilt_version = "1.0.0-alpha01"
    kapt "androidx.hilt:hilt-compiler:$android_hilt_version"
    // hilt-view_model
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$android_hilt_version"

    // support v7 preference
    // implementation 'com.android.support:preference-v7:28.0.0'

    def preference_version = "1.1.1"

    // Java language implementation
    implementation "androidx.preference:preference:$preference_version"
    // Kotlin
    implementation "androidx.preference:preference-ktx:$preference_version"

    // Huawei scan kit
    implementation 'com.huawei.hms:scanplus:1.3.2.300'
}