mirror of
https://github.com/ev-map/EVMap.git
synced 2026-09-12 21:37:01 -04:00
update Google Maps & Places
This commit is contained in:
1 parent
e342f3e424
commit
6d351d4fa9
2 files changed
+6
-6
No files matched your search
+4
-4
@@ -19,7 +19,6 @@ import com.google.android.libraries.places.api.net.FetchPlaceRequest
|
||||
import com.google.android.libraries.places.api.net.FindAutocompletePredictionsRequest
|
||||
import com.google.android.libraries.places.api.net.PlacesStatusCodes
|
||||
import kotlinx.coroutines.tasks.await
|
||||
import net.vonforst.evmap.R
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.ExecutionException
|
||||
import kotlin.math.sqrt
|
||||
@@ -53,7 +52,7 @@ class GooglePlacesAutocompleteProvider(val context: Context) : AutocompleteProvi
|
||||
it.getSecondaryText(bold),
|
||||
it.placeId,
|
||||
it.distanceMeters?.toDouble(),
|
||||
it.placeTypes.map { AutocompletePlaceType.valueOf(it.name) })
|
||||
it.types.mapNotNull { AutocompletePlaceType.valueOfOrNull(it.uppercase()) })
|
||||
}
|
||||
} catch (e: ExecutionException) {
|
||||
val cause = e.cause
|
||||
@@ -75,12 +74,13 @@ class GooglePlacesAutocompleteProvider(val context: Context) : AutocompleteProvi
|
||||
|
||||
override suspend fun getDetails(id: String): PlaceWithBounds {
|
||||
val request =
|
||||
FetchPlaceRequest.builder(id, listOf(Place.Field.LAT_LNG, Place.Field.VIEWPORT)).build()
|
||||
FetchPlaceRequest.builder(id, listOf(Place.Field.LOCATION, Place.Field.VIEWPORT))
|
||||
.build()
|
||||
try {
|
||||
val place = client.fetchPlace(request).await().place
|
||||
token = AutocompleteSessionToken.newInstance()
|
||||
return PlaceWithBounds(
|
||||
AnyMapAdapter.adapt(place.latLng),
|
||||
AnyMapAdapter.adapt(place.location),
|
||||
AnyMapAdapter.adapt(place.viewport)
|
||||
)
|
||||
} catch (e: ApiException) {
|
||||
|
||||
@@ -29,8 +29,8 @@ bimap = "1.1.0"
|
||||
mapscaleview = "1.6.0"
|
||||
carApp = "1.8.0-beta01"
|
||||
anymaps = "596b491875"
|
||||
playServicesMaps = "19.2.0"
|
||||
places = "3.5.0"
|
||||
playServicesMaps = "20.0.0"
|
||||
places = "4.4.1" # last version that supports minSdkVersion 23
|
||||
kotlinxCoroutinesPlayServices = "1.10.2"
|
||||
mapLibre = "13.4.1"
|
||||
mapboxServices = "5.8.0"
|
||||
|
||||
Reference in new issue
Block a user