Skip to content

Commit

Permalink
Update to Kotlin 1.5 and bump libraries
Browse files Browse the repository at this point in the history
This fixes #88

Signed-off-by: Rafael Chagas <[email protected]>
  • Loading branch information
rtchagas committed Aug 14, 2021
1 parent c5f8592 commit 598bcd0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 59 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.5.21'

repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
48 changes: 23 additions & 25 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt'

android {

compileSdkVersion 29
compileSdkVersion 30

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -19,9 +19,7 @@ android {

defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
targetSdkVersion 30
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -43,53 +41,53 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// KTX
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.core:core-ktx:1.6.0'

// Anko Commons
implementation "org.jetbrains.anko:anko-commons:0.10.8"

// Support library
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0-beta01'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.5.0-alpha02'

// Android architecture components
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'

// Google Play Services
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.6.2'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.maps.android:android-maps-utils:2.2.5'
implementation 'com.google.android.libraries.places:places:2.4.0'

// Koin for Android
implementation 'org.koin:koin-android:2.2.2'
implementation 'org.koin:koin-android-viewmodel:2.2.2'
implementation 'io.insert-koin:koin-android:2.2.3'
implementation 'io.insert-koin:koin-android-viewmodel:2.2.3'

// Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'

// Moshi
implementation 'com.squareup.moshi:moshi:1.9.2'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.9.2'
implementation 'com.squareup.moshi:moshi:1.12.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.12.0'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-moshi:2.7.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.3'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'

// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'

// 3rd party
implementation 'com.github.mcginty:material-colors:1.1.0'
implementation 'com.karumi:dexter:6.1.0'
implementation 'com.karumi:dexter:6.2.3'

testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ object PermissionsHelper {
fun checkForLocationPermission(activity: Activity, listener: BasePermissionListener?) {

val dialogPermissionListener = DialogOnDeniedPermissionListener.Builder
.withContext(activity)
.withTitle(R.string.permission_fine_location_title)
.withMessage(R.string.permission_fine_location_message)
.withButtonText(android.R.string.ok)
.withIcon(R.drawable.ic_map_marker_radius_black_24dp)
.build()
.withContext(activity)
.withTitle(R.string.permission_fine_location_title)
.withMessage(R.string.permission_fine_location_message)
.withButtonText(android.R.string.ok)
.withIcon(R.drawable.ic_map_marker_radius_black_24dp)
.build()

val compositeListener =
if (listener != null) {
CompositePermissionListener(dialogPermissionListener, listener)
}
else {
CompositePermissionListener(dialogPermissionListener)
}
if (listener != null) {
CompositePermissionListener(dialogPermissionListener, listener)
} else {
CompositePermissionListener(dialogPermissionListener)
}

Dexter.withActivity(activity)
.withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
.withListener(compositeListener)
.check()
Dexter.withContext(activity)
.withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
.withListener(compositeListener)
.check()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ class PlacePickerActivity : AppCompatActivity(),

for (place in places) {
place.latLng?.let {
val marker: Marker = addMarker(
val marker: Marker? = addMarker(
MarkerOptions()
.position(it)
.icon(getPlaceMarkerBitmap(place))
)

marker.tag = place
marker?.tag = place
}
}
}
Expand Down Expand Up @@ -292,8 +292,8 @@ class PlacePickerActivity : AppCompatActivity(),
try {
val locationResult = fusedLocationProviderClient.lastLocation
locationResult
?.addOnFailureListener(this) { setDefaultLocation() }
?.addOnSuccessListener(this) { location: Location? ->
.addOnFailureListener(this) { setDefaultLocation() }
.addOnSuccessListener(this) { location: Location? ->

// In rare cases location may be null...
if (location == null) {
Expand All @@ -320,7 +320,7 @@ class PlacePickerActivity : AppCompatActivity(),
lastKnownLocation = LatLng(location.latitude, location.longitude)

val update = CameraUpdateFactory
.newLatLngZoom(lastKnownLocation, defaultZoom)
.newLatLngZoom(lastKnownLocation!!, defaultZoom)

if (animate) {
googleMap?.animateCamera(update)
Expand Down Expand Up @@ -602,8 +602,10 @@ class PlacePickerActivity : AppCompatActivity(),

googleMap?.let {

it.uiSettings?.isMyLocationButtonEnabled = false
it.uiSettings?.isMapToolbarEnabled = false
with(it.uiSettings) {
isMyLocationButtonEnabled = false
isMapToolbarEnabled = false
}

if (isLocationPermissionGranted) {
it.isMyLocationEnabled = true
Expand Down
12 changes: 6 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'

android {

compileSdkVersion 29
compileSdkVersion 30

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -14,7 +14,7 @@ android {
defaultConfig {
applicationId "com.rtchagas.pingsample"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"

Expand All @@ -41,17 +41,17 @@ dependencies {
implementation "org.jetbrains.anko:anko-commons:0.10.8"

// Support library
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0-beta01'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.5.0-alpha02'

// Places library
implementation 'com.google.android.libraries.places:places:2.4.0'

// Other
implementation 'com.github.mcginty:material-colors:1.1.0'

testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

0 comments on commit 598bcd0

Please sign in to comment.