From 4f0c0b96fa1dfb59a1113885d124eb6c6f95120b Mon Sep 17 00:00:00 2001 From: Yusuf Saifudin Date: Fri, 12 Apr 2024 13:48:31 +0700 Subject: [PATCH] :tractor: migrate kotlin dsl --- .idea/.name | 1 + .idea/kotlinc.xml | 2 +- README.md | 1 - app/build.gradle.kts | 142 ++++++++++++++++++ .../com/yoesuv/infomadiun/utils/AppHelper.kt | 5 +- .../utils/binding/BindingExtension.kt | 4 +- build.gradle.kts | 19 +++ gradle.properties | 9 +- settings.gradle.kts | 17 +++ 9 files changed, 188 insertions(+), 12 deletions(-) create mode 100644 .idea/.name create mode 100644 app/build.gradle.kts create mode 100644 build.gradle.kts create mode 100644 settings.gradle.kts diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..74b951b --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Explore Madiun \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 217e5c5..fdf8d99 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/README.md b/README.md index 3a78966..716411a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ DIRECTION_API_KEY = your_map_direction_api_key * [Retrofit](https://github.com/square/retrofit) * [SDP](https://github.com/intuit/sdp) * [SSP](https://github.com/intuit/ssp) -* [Toasty](https://github.com/GrenderG/Toasty) ## License ## diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..d7236b2 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,142 @@ +import java.util.Properties + +val apiKeyPropertiesFile = project.rootProject.file("apiKey.properties") +val apiKeyProperties = Properties() +apiKeyProperties.load(apiKeyPropertiesFile.inputStream()) + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("kotlin-kapt") + id("kotlin-parcelize") + id("com.google.gms.google-services") + id("com.google.firebase.firebase-perf") + id("com.google.firebase.crashlytics") + id("androidx.navigation.safeargs") + id("com.google.devtools.ksp") +} + +android { + + signingConfigs { + create("config") { + keyAlias = project.properties["KEY_ALIAS"].toString() + keyPassword = project.properties["KEY_PASSWORD"].toString() + storeFile = file("../-yusuf.keystore") + storePassword = project.properties["STORE_PASSWORD"].toString() + } + } + + namespace = "com.yoesuv.infomadiun" + compileSdk = project.properties["targetApiLevel"].toString().toInt() + + defaultConfig { + val keyMaps = apiKeyProperties["MAPS_API_KEY"].toString() + val keyDirections = apiKeyProperties["DIRECTION_API_KEY"].toString() + + applicationId = "com.yoesuv.infomadiun" + minSdk = project.properties["minApiLevel"].toString().toInt() + targetSdk = project.properties["targetApiLevel"].toString().toInt() + versionCode = project.properties["versionCode"].toString().toInt() + versionName = project.properties["versionName"].toString() + vectorDrawables { + useSupportLibrary = true + } + setProperty("archivesBaseName", "$applicationId-v$versionCode($versionName)") + resValue("string", "MAPS_API_KEY", keyMaps) + resValue("string", "DIRECTION_API_KEY", keyDirections) + } + + buildTypes { + debug { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("config") + } + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("config") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + + sourceSets { + getByName("main") { + res.srcDirs("src/main/res") + res.srcDirs("src/main/res-menu") + res.srcDirs("src/main/res-menu/gallery") + res.srcDirs("src/main/res-menu/listplace") + res.srcDirs("src/main/res-menu/maps") + res.srcDirs("src/main/res-menu/other") + } + } + + buildFeatures { + dataBinding = true + buildConfig = true + } + flavorDimensions.add("default") + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + val playServiceMapsVersion: String by project + val playServiceLocationVersion: String by project + val lifeCycleVersion: String by project + val navigationVersion: String by project + val roomVersion: String by project + val viewPager2Version: String by project + val retrofitVersion: String by project + val httpLoggingVersion: String by project + val glideVersion: String by project + val googleDirectionLibraryVersion: String by project + val sspVersion: String by project + val sdpVersion: String by project + + implementation("androidx.core:core-ktx:1.12.0") + implementation ("androidx.appcompat:appcompat:1.6.1") + implementation("com.google.android.material:material:1.9.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation("androidx.test.espresso:espresso-contrib:3.5.1") + + implementation("com.google.android.gms:play-services-maps:$playServiceMapsVersion") + implementation("com.google.android.gms:play-services-location:$playServiceLocationVersion") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifeCycleVersion") + implementation("androidx.navigation:navigation-fragment-ktx:$navigationVersion") + implementation("androidx.navigation:navigation-ui-ktx:$navigationVersion") + implementation("androidx.room:room-runtime:$roomVersion") + ksp("androidx.room:room-compiler:$roomVersion") + implementation("androidx.room:room-ktx:$roomVersion") + implementation("androidx.viewpager2:viewpager2:$viewPager2Version") + + implementation(platform("com.google.firebase:firebase-bom:32.1.1")) + implementation("com.google.firebase:firebase-perf") + implementation("com.google.firebase:firebase-crashlytics") + implementation("com.google.firebase:firebase-analytics") + + implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") + implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion") + implementation("com.squareup.okhttp3:logging-interceptor:$httpLoggingVersion") + + implementation("com.github.bumptech.glide:glide:$glideVersion") + ksp("com.github.bumptech.glide:compiler:$glideVersion") + implementation("com.akexorcist:google-direction-library:$googleDirectionLibraryVersion") + implementation("com.intuit.ssp:ssp-android:$sspVersion") + implementation("com.intuit.sdp:sdp-android:$sdpVersion") +} \ No newline at end of file diff --git a/app/src/main/java/com/yoesuv/infomadiun/utils/AppHelper.kt b/app/src/main/java/com/yoesuv/infomadiun/utils/AppHelper.kt index 8f37849..3978030 100644 --- a/app/src/main/java/com/yoesuv/infomadiun/utils/AppHelper.kt +++ b/app/src/main/java/com/yoesuv/infomadiun/utils/AppHelper.kt @@ -15,7 +15,6 @@ import com.google.android.gms.location.LocationServices import com.google.android.gms.location.LocationSettingsRequest import com.google.android.gms.location.LocationSettingsStatusCodes import com.google.android.gms.location.Priority -import es.dmoral.toasty.Toasty /** * Updated by yusuf on 12 July 2020 @@ -24,11 +23,11 @@ import es.dmoral.toasty.Toasty object AppHelper { fun displayNormalToast(context: Context, @StringRes message: Int) { - Toasty.normal(context, message, Toast.LENGTH_SHORT).show() + Toast.makeText(context, message, Toast.LENGTH_SHORT).show() } fun displayErrorToast(context: Context, @StringRes message: Int) { - Toasty.error(context, message, Toast.LENGTH_SHORT, true).show() + Toast.makeText(context, message, Toast.LENGTH_SHORT).show() } fun checkLocationSetting(context: Context): Boolean { diff --git a/app/src/main/java/com/yoesuv/infomadiun/utils/binding/BindingExtension.kt b/app/src/main/java/com/yoesuv/infomadiun/utils/binding/BindingExtension.kt index 0b81d02..35c1b87 100644 --- a/app/src/main/java/com/yoesuv/infomadiun/utils/binding/BindingExtension.kt +++ b/app/src/main/java/com/yoesuv/infomadiun/utils/binding/BindingExtension.kt @@ -3,11 +3,11 @@ package com.yoesuv.infomadiun.utils.binding import androidx.appcompat.widget.AppCompatImageView import androidx.databinding.BindingAdapter import com.bumptech.glide.GenericTransitionOptions -import com.yoesuv.infomadiun.utils.glide.GlideApp +import com.bumptech.glide.Glide @BindingAdapter("loadImage") fun AppCompatImageView.loadImage(imageUrl: String) { - GlideApp.with(this.context.applicationContext) + Glide.with(this.context.applicationContext) .load(imageUrl) .transition(GenericTransitionOptions.with(android.R.anim.fade_in)) .into(this) diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..a07f190 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "8.2.2" apply false + id("org.jetbrains.kotlin.android") version "1.9.0" apply false + id("com.google.gms.google-services") version "4.4.1" apply false + id("com.google.firebase.firebase-perf") version "1.4.2" apply false + id("com.google.firebase.crashlytics") version "2.9.9" apply false + id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false +} + +buildscript { + repositories { + google() + } + dependencies { + val nav_version = "2.7.7" + classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version") + } +} diff --git a/gradle.properties b/gradle.properties index ac6af27..92c2473 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,13 +27,13 @@ KEY_PASSWORD = idamanmertua STORE_PASSWORD = idamanmertua # project data -minApiLevel = 21 +minApiLevel = 23 targetApiLevel = 34 -versionCode = 18 -versionName = 2.0.7 +versionCode = 19 +versionName = 2.0.8 #library -glideVersion = 4.15.1 +glideVersion = 4.16.0 googleDirectionLibraryVersion = 1.2.1 httpLoggingVersion = 4.11.0 lifeCycleVersion = 2.6.1 @@ -45,5 +45,4 @@ retrofitVersion = 2.9.0 roomVersion = 2.5.1 sdpVersion = 1.1.0 sspVersion = 1.1.0 -toastyVersion = 1.5.2 viewPager2Version = 1.0.0 \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..0792088 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "Explore Madiun" +include(":app")