Skip to content

Commit

Permalink
🚜 migrate kotlin dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
yoesuv committed Apr 12, 2024
1 parent b984ae7 commit 4f0c0b9
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 12 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
Expand Down
142 changes: 142 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
5 changes: 2 additions & 3 deletions app/src/main/java/com/yoesuv/infomadiun/utils/AppHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
}
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
17 changes: 17 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 4f0c0b9

Please sign in to comment.