diff --git a/build.gradle b/build.gradle
index b6ba842..0ec2294 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.5.21'
+ ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.0'
+ classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
diff --git a/library/build.gradle b/library/build.gradle
index d9cdf94..65b4eea 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
android {
- compileSdkVersion 30
+ compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -20,7 +20,7 @@ android {
defaultConfig {
minSdkVersion 19
- targetSdkVersion 30
+ targetSdkVersion 31
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -41,29 +41,28 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// KTX
- implementation 'androidx.core:core-ktx:1.6.0'
+ implementation 'androidx.core:core-ktx:1.7.0'
// Anko Commons
implementation "org.jetbrains.anko:anko-commons:0.10.8"
// Support library
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
- implementation 'com.google.android.material:material:1.5.0-alpha02'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
+ implementation 'com.google.android.material:material:1.5.0-rc01'
// Android architecture components
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
+ implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0'
// Google Play Services
- 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.android.gms:play-services-location:19.0.1'
+ implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.maps.android:android-maps-utils:2.2.5'
- implementation 'com.google.android.libraries.places:places:2.4.0'
+ implementation 'com.google.android.libraries.places:places:2.5.0'
// Koin for Android
- implementation 'io.insert-koin:koin-android:2.2.3'
- implementation 'io.insert-koin:koin-android-viewmodel:2.2.3'
+ implementation 'io.insert-koin:koin-android:3.1.5'
// Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
@@ -71,14 +70,14 @@ dependencies {
implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
// Moshi
- implementation 'com.squareup.moshi:moshi:1.12.0'
- kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.12.0'
+ implementation 'com.squareup.moshi:moshi:1.13.0'
+ kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.13.0'
// Retrofit
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'
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 1059ab0..3b0c287 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,30 +1,31 @@
-
+
+ android:required="true" />
-
-
-
+
+
+
+
+ android:theme="@style/PingTheme.NoStatus" />
+ android:required="false" />
+ android:value="@integer/google_play_services_version" />
-
\ No newline at end of file
+
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/inject/PingKoinComponent.kt b/library/src/main/java/com/rtchagas/pingplacepicker/inject/PingKoinComponent.kt
index 667ff2d..cba4dd1 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/inject/PingKoinComponent.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/inject/PingKoinComponent.kt
@@ -1,11 +1,12 @@
package com.rtchagas.pingplacepicker.inject
import android.content.Context
+import com.rtchagas.pingplacepicker.BuildConfig
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.Koin
-import org.koin.core.component.KoinApiExtension
import org.koin.core.component.KoinComponent
+import org.koin.core.logger.Level
import org.koin.dsl.koinApplication
object PingKoinContext {
@@ -14,7 +15,7 @@ object PingKoinContext {
val koin: Koin by lazy {
koinApplication {
- androidLogger()
+ androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
androidContext(appContext)
modules(listOf(repositoryModule, viewModelModule))
}.koin
@@ -30,7 +31,6 @@ object PingKoinContext {
}
}
-@OptIn(KoinApiExtension::class)
interface PingKoinComponent : KoinComponent {
override fun getKoin(): Koin = PingKoinContext.koin
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/inject/ViewModelModule.kt b/library/src/main/java/com/rtchagas/pingplacepicker/inject/ViewModelModule.kt
index 871bddb..2198d32 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/inject/ViewModelModule.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/inject/ViewModelModule.kt
@@ -2,7 +2,7 @@ package com.rtchagas.pingplacepicker.inject
import com.rtchagas.pingplacepicker.viewmodel.PlaceConfirmDialogViewModel
import com.rtchagas.pingplacepicker.viewmodel.PlacePickerViewModel
-import org.koin.android.viewmodel.dsl.viewModel
+import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
val viewModelModule = module {
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/CustomPlace.kt b/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/CustomPlace.kt
index aff9c82..af9f5f7 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/CustomPlace.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/CustomPlace.kt
@@ -56,6 +56,10 @@ class CustomPlace(
return null
}
+ override fun getIconBackgroundColor(): Int? {
+ return null
+ }
+
override fun getPriceLevel(): Int? {
return null
}
@@ -72,6 +76,10 @@ class CustomPlace(
return placeAddress
}
+ override fun getIconUrl(): String? {
+ return null
+ }
+
override fun getPlusCode(): PlusCode? {
return null
}
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/PlaceFromCoordinates.kt b/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/PlaceFromCoordinates.kt
index ec45c8c..1d1ba40 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/PlaceFromCoordinates.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/repository/googlemaps/PlaceFromCoordinates.kt
@@ -12,8 +12,11 @@ import kotlin.math.absoluteValue
/**
* Place without any additional info. Just latitude and longitude.
*/
-internal class PlaceFromCoordinates(private val latitude: Double, private val longitude: Double) :
- Place() {
+internal class PlaceFromCoordinates(
+ private val latitude: Double,
+ private val longitude: Double
+) : Place() {
+
constructor(parcel: Parcel) : this(
parcel.readDouble(),
parcel.readDouble()
@@ -59,6 +62,10 @@ internal class PlaceFromCoordinates(private val latitude: Double, private val lo
return null
}
+ override fun getIconBackgroundColor(): Int? {
+ return null
+ }
+
override fun getPriceLevel(): Int? {
return null
}
@@ -75,6 +82,10 @@ internal class PlaceFromCoordinates(private val latitude: Double, private val lo
return null
}
+ override fun getIconUrl(): String? {
+ return null
+ }
+
override fun getPlusCode(): PlusCode? {
return null
}
@@ -118,22 +129,26 @@ internal class PlaceFromCoordinates(private val latitude: Double, private val lo
private fun formatLatitude(latitude: Double): String {
val direction = if (latitude > 0) "N" else "S"
- return "${replaceDelimiters(
- Location.convert(
- latitude.absoluteValue,
- Location.FORMAT_SECONDS
+ return "${
+ replaceDelimiters(
+ Location.convert(
+ latitude.absoluteValue,
+ Location.FORMAT_SECONDS
+ )
)
- )} $direction"
+ } $direction"
}
private fun formatLongitude(longitude: Double): String {
val direction = if (longitude > 0) "W" else "E"
- return "${replaceDelimiters(
- Location.convert(
- longitude.absoluteValue,
- Location.FORMAT_SECONDS
+ return "${
+ replaceDelimiters(
+ Location.convert(
+ longitude.absoluteValue,
+ Location.FORMAT_SECONDS
+ )
)
- )} $direction"
+ } $direction"
}
private fun replaceDelimiters(original: String): String {
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlaceConfirmDialogFragment.kt b/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlaceConfirmDialogFragment.kt
index 6fbb4d6..2702597 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlaceConfirmDialogFragment.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlaceConfirmDialogFragment.kt
@@ -12,7 +12,6 @@ import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.core.view.isVisible
-import androidx.lifecycle.Observer
import androidx.transition.TransitionManager
import com.google.android.libraries.places.api.model.Place
import com.rtchagas.pingplacepicker.Config
@@ -25,7 +24,7 @@ import com.rtchagas.pingplacepicker.viewmodel.Resource
import com.squareup.picasso.Callback
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.fragment_dialog_place_confirm.view.*
-import org.koin.android.viewmodel.ext.android.viewModel
+import org.koin.androidx.viewmodel.ext.android.viewModel
import java.util.*
@@ -72,7 +71,7 @@ class PlaceConfirmDialogFragment : AppCompatDialogFragment(), PingKoinComponent
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val builder = AlertDialog.Builder(activity!!)
+ val builder = AlertDialog.Builder(requireActivity())
builder.setTitle(R.string.picker_place_confirm)
.setView(getContentView(requireContext()))
@@ -138,7 +137,7 @@ class PlaceConfirmDialogFragment : AppCompatDialogFragment(), PingKoinComponent
) {
val photoMetadata = photoMetadatas[0]
viewModel.getPlacePhoto(photoMetadata).observe(this,
- Observer { handlePlacePhotoLoaded(contentView, it) })
+ { handlePlacePhotoLoaded(contentView, it) })
} else {
handlePlacePhotoLoaded(contentView, Resource.noData())
}
diff --git a/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlacePickerActivity.kt b/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlacePickerActivity.kt
index 9eed082..374ac9c 100644
--- a/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlacePickerActivity.kt
+++ b/library/src/main/java/com/rtchagas/pingplacepicker/ui/PlacePickerActivity.kt
@@ -46,7 +46,7 @@ import com.rtchagas.pingplacepicker.viewmodel.Resource
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.activity_place_picker.*
import org.jetbrains.anko.toast
-import org.koin.android.viewmodel.ext.android.viewModel
+import org.koin.androidx.viewmodel.ext.android.viewModel
import kotlin.math.abs
class PlacePickerActivity : AppCompatActivity(),
@@ -178,10 +178,11 @@ class PlacePickerActivity : AppCompatActivity(),
disposables.clear()
}
- override fun onMapReady(map: GoogleMap?) {
+ @SuppressLint("PotentialBehaviorOverride")
+ override fun onMapReady(map: GoogleMap) {
googleMap = map
setMapStyle()
- map?.setOnMarkerClickListener(this)
+ map.setOnMarkerClickListener(this)
checkForPermission()
}
diff --git a/sample/build.gradle b/sample/build.gradle
index 8fe45e6..9edfe5e 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'
android {
- compileSdkVersion 30
+ compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -14,7 +14,7 @@ android {
defaultConfig {
applicationId "com.rtchagas.pingsample"
minSdkVersion 21
- targetSdkVersion 30
+ targetSdkVersion 31
versionCode 1
versionName "1.0"
@@ -35,18 +35,18 @@ dependencies {
implementation project(':library')
// Kotlin
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// Anko Commons
implementation "org.jetbrains.anko:anko-commons:0.10.8"
// Support library
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
- implementation 'com.google.android.material:material:1.5.0-alpha02'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
+ implementation 'com.google.android.material:material:1.5.0-rc01'
// Places library
- implementation 'com.google.android.libraries.places:places:2.4.0'
+ implementation 'com.google.android.libraries.places:places:2.5.0'
// Other
implementation 'com.github.mcginty:material-colors:1.1.0'
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index a7ceca6..b4b55b1 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
+ android:value="@string/key_google_apis_android" />
-
+
-
+
-
+