From d794acfb945013218c0925b82bf9b219eb964cc6 Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Wed, 30 Mar 2022 10:02:15 -0700 Subject: [PATCH] feat: Bump Kotlin and coroutines to 1.6 (#178) --- README.md | 2 -- app/build.gradle | 5 ++--- .../maps/android/ktx/demo/MainActivity.kt | 3 --- build.gradle | 4 ++-- .../com/google/maps/android/ktx/GoogleMap.kt | 21 ------------------- .../android/ktx/StreetViewPanoramaView.kt | 5 ----- 6 files changed, 4 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 548e163..4a0087b 100644 --- a/README.md +++ b/README.md @@ -136,8 +136,6 @@ override fun onCreate(savedInstanceState: Bundle?) { #### Flow -> **Note**: The following feature utilizes an experimental coroutine API. To use this, you will have to add the `@OptIn(ExperimentalCoroutinesApi::class)` at the site of its usage as well as the compiler flag `-Xopt-in=kotlin.RequiresOptIn`. - Listing to camera events can be collected via [Kotlin Flow](kotlin-flow). _Before_ diff --git a/app/build.gradle b/app/build.gradle index 409c7bd..d6168a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,7 +45,6 @@ android { } kotlinOptions { - freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] jvmTarget = "1.8" } } @@ -57,8 +56,8 @@ dependencies { implementation deps.kotlin implementation deps.androidx.appcompat implementation deps.androidx.coreKtx - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' - implementation 'com.google.android.gms:play-services-maps:17.0.1' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' + implementation 'com.google.android.gms:play-services-maps:18.0.2' // implementation 'com.google.maps.android:maps-ktx:3.0.1' implementation project(':maps-ktx') // implementation project(':maps-utils-ktx') diff --git a/app/src/main/java/com/google/maps/android/ktx/demo/MainActivity.kt b/app/src/main/java/com/google/maps/android/ktx/demo/MainActivity.kt index 2be4f3e..7709fdc 100644 --- a/app/src/main/java/com/google/maps/android/ktx/demo/MainActivity.kt +++ b/app/src/main/java/com/google/maps/android/ktx/demo/MainActivity.kt @@ -44,8 +44,6 @@ import com.google.maps.android.ktx.model.cameraPosition import com.google.maps.android.ktx.utils.collection.addMarker import com.google.maps.android.ktx.utils.geojson.geoJsonLayer import com.google.maps.android.ktx.utils.kml.kmlLayer -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import org.json.JSONException @@ -63,7 +61,6 @@ class MainActivity : AppCompatActivity() { private val sanFrancisco = LatLng( 37.7576, -122.4194) private var currentLocation = london - @OptIn(ExperimentalCoroutinesApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val isRestore = savedInstanceState != null diff --git a/build.gradle b/build.gradle index 9c9cf0e..e3609b5 100644 --- a/build.gradle +++ b/build.gradle @@ -31,8 +31,8 @@ buildscript { 'junit' : '1.1.1', ], 'junit' : '4.12', - 'kotlin' : '1.5.30', - 'kotlinxCoroutines': '1.5.1', + 'kotlin' : '1.6.10', + 'kotlinxCoroutines': '1.6.0', 'mapsBeta' : '3.1.0-beta', 'mockito' : '3.0.0', 'mockitoKotlin' : '2.2.0', diff --git a/maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt b/maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt index 3068aa9..21f5d27 100644 --- a/maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt +++ b/maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt @@ -25,7 +25,6 @@ import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.GoogleMapOptions import com.google.android.gms.maps.model.* import com.google.maps.android.ktx.model.* -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow @@ -92,7 +91,6 @@ public data class IndoorLevelActivatedEvent(val building: IndoorBuilding) : Indo * [GoogleMap.setOnCameraIdleListener], [GoogleMap.setOnCameraMoveCanceledListener], * [GoogleMap.setOnCameraMoveListener] and [GoogleMap.setOnCameraMoveStartedListener]. */ -@ExperimentalCoroutinesApi @Deprecated( message = "Use cameraIdleEvents(), cameraMoveCanceledEvents(), cameraMoveEvents() or cameraMoveStartedEvents", ) @@ -155,7 +153,6 @@ public suspend inline fun GoogleMap.awaitMapLoad(): Unit = * Returns a flow that emits when the camera is idle. Using this to observe camera idle events will * override an existing listener (if any) to [GoogleMap.setOnCameraIdleListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.cameraIdleEvents(): Flow = callbackFlow { setOnCameraIdleListener { @@ -171,7 +168,6 @@ public fun GoogleMap.cameraIdleEvents(): Flow = * cancel events will override an existing listener (if any) to * [GoogleMap.setOnCameraMoveCanceledListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.cameraMoveCanceledEvents(): Flow = callbackFlow { setOnCameraMoveCanceledListener { @@ -186,7 +182,6 @@ public fun GoogleMap.cameraMoveCanceledEvents(): Flow = * Returns a flow that emits when the camera moves. Using this to observe camera move events will * override an existing listener (if any) to [GoogleMap.setOnCameraMoveListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.cameraMoveEvents(): Flow = callbackFlow { setOnCameraMoveListener { @@ -213,7 +208,6 @@ public suspend inline fun GoogleMap.awaitSnapshot(bitmap: Bitmap? = null): Bitma * Returns a flow that emits when a camera move started. Using this to observe camera move start * events will override an existing listener (if any) to [GoogleMap.setOnCameraMoveStartedListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.cameraMoveStartedEvents(): Flow = callbackFlow { setOnCameraMoveStartedListener { @@ -228,7 +222,6 @@ public fun GoogleMap.cameraMoveStartedEvents(): Flow = * Returns a flow that emits when a circle is clicked. Using this to observe circle clicks events * will override an existing listener (if any) to [GoogleMap.setOnCircleClickListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.circleClickEvents(): Flow = callbackFlow { setOnCircleClickListener { @@ -244,7 +237,6 @@ public fun GoogleMap.circleClickEvents(): Flow = * clicks events will override an existing listener (if any) to * [GoogleMap.setOnGroundOverlayClickListener]. */ -@ExperimentalCoroutinesApi public fun GoogleMap.groundOverlayClicks(): Flow = callbackFlow { setOnGroundOverlayClickListener { @@ -260,7 +252,6 @@ public fun GoogleMap.groundOverlayClicks(): Flow = * change events will override an existing listener (if any) to * [GoogleMap.setOnIndoorStateChangeListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.indoorStateChangeEvents(): Flow = callbackFlow { setOnIndoorStateChangeListener(object : GoogleMap.OnIndoorStateChangeListener { @@ -282,7 +273,6 @@ public fun GoogleMap.indoorStateChangeEvents(): Flow = * info window clicks will override an existing listener (if any) to * [GoogleMap.setOnInfoWindowClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.infoWindowClickEvents(): Flow = callbackFlow { setOnInfoWindowClickListener { @@ -298,7 +288,6 @@ public fun GoogleMap.infoWindowClickEvents(): Flow = * window closes will override an existing listener (if any) to * [GoogleMap.setOnInfoWindowCloseListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.infoWindowCloseEvents(): Flow = callbackFlow { setOnInfoWindowCloseListener { @@ -314,7 +303,6 @@ public fun GoogleMap.infoWindowCloseEvents(): Flow = * window long presses will override an existing listener (if any) to * [GoogleMap.setOnInfoWindowLongClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.infoWindowLongClickEvents(): Flow = callbackFlow { setOnInfoWindowLongClickListener { @@ -329,7 +317,6 @@ public fun GoogleMap.infoWindowLongClickEvents(): Flow = * Returns a flow that emits when the map is clicked. Using this to observe map click events will * override an existing listener (if any) to [GoogleMap.setOnMapClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.mapClickEvents(): Flow = callbackFlow { setOnMapClickListener { @@ -344,7 +331,6 @@ public fun GoogleMap.mapClickEvents(): Flow = * Returns a flow that emits when the map is long clicked. Using this to observe map click events * will override an existing listener (if any) to [GoogleMap.setOnMapLongClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.mapLongClickEvents(): Flow = callbackFlow { setOnMapLongClickListener { @@ -359,7 +345,6 @@ public fun GoogleMap.mapLongClickEvents(): Flow = * Returns a flow that emits when a marker on the map is clicked. Using this to observe marker click * events will override an existing listener (if any) to [GoogleMap.setOnMarkerClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.markerClickEvents(): Flow = callbackFlow { setOnMarkerClickListener { @@ -374,7 +359,6 @@ public fun GoogleMap.markerClickEvents(): Flow = * Returns a flow that emits when a marker is dragged. Using this to observer marker drag events * will override existing listeners (if any) to [GoogleMap.setOnMarkerDragListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.markerDragEvents(): Flow = callbackFlow { setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener { @@ -401,7 +385,6 @@ public fun GoogleMap.markerDragEvents(): Flow = * location button click events will override an existing listener (if any) to * [GoogleMap.setOnMyLocationButtonClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.myLocationButtonClickEvents(): Flow = callbackFlow { setOnMyLocationButtonClickListener { @@ -417,7 +400,6 @@ public fun GoogleMap.myLocationButtonClickEvents(): Flow = * location blue dot click events will override an existing listener (if any) to * [GoogleMap.setOnMyLocationClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.myLocationClickEvents(): Flow = callbackFlow { setOnMyLocationClickListener { @@ -433,7 +415,6 @@ public fun GoogleMap.myLocationClickEvents(): Flow = * PointOfInterest click events will override an existing listener (if any) to * [GoogleMap.setOnPoiClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.poiClickEvents(): Flow = callbackFlow { setOnPoiClickListener { @@ -448,7 +429,6 @@ public fun GoogleMap.poiClickEvents(): Flow = * Returns a flow that emits when a Polygon is clicked. Using this to observe Polygon click events * will override an existing listener (if any) to [GoogleMap.setOnPolygonClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.polygonClickEvents(): Flow = callbackFlow { setOnPolygonClickListener { @@ -463,7 +443,6 @@ public fun GoogleMap.polygonClickEvents(): Flow = * Returns a flow that emits when a Polyline is clicked. Using this to observe Polyline click events * will override an existing listener (if any) to [GoogleMap.setOnPolylineClickListener] */ -@ExperimentalCoroutinesApi public fun GoogleMap.polylineClickEvents(): Flow = callbackFlow { setOnPolylineClickListener { diff --git a/maps-ktx/src/main/java/com/google/maps/android/ktx/StreetViewPanoramaView.kt b/maps-ktx/src/main/java/com/google/maps/android/ktx/StreetViewPanoramaView.kt index 0b63a61..cc30615 100644 --- a/maps-ktx/src/main/java/com/google/maps/android/ktx/StreetViewPanoramaView.kt +++ b/maps-ktx/src/main/java/com/google/maps/android/ktx/StreetViewPanoramaView.kt @@ -5,7 +5,6 @@ import com.google.android.gms.maps.StreetViewPanoramaView import com.google.android.gms.maps.model.StreetViewPanoramaCamera import com.google.android.gms.maps.model.StreetViewPanoramaLocation import com.google.android.gms.maps.model.StreetViewPanoramaOrientation -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow @@ -32,7 +31,6 @@ public suspend inline fun StreetViewPanoramaView.awaitStreetViewPanorama(): Stre * observe panorama camera change events will override an existing listener (if any) to * [StreetViewPanorama.setOnStreetViewPanoramaCameraChangeListener]. */ -@ExperimentalCoroutinesApi public fun StreetViewPanorama.cameraChangeEvents(): Flow = callbackFlow { setOnStreetViewPanoramaCameraChangeListener { @@ -48,7 +46,6 @@ public fun StreetViewPanorama.cameraChangeEvents(): Flow = callbackFlow { setOnStreetViewPanoramaChangeListener { @@ -64,7 +61,6 @@ public fun StreetViewPanorama.changeEvents(): Flow = * observe panorama click events will override an existing listener (if any) to * [StreetViewPanorama.setOnStreetViewPanoramaClickListener]. */ -@ExperimentalCoroutinesApi public fun StreetViewPanorama.clickEvents(): Flow = callbackFlow { setOnStreetViewPanoramaClickListener { @@ -80,7 +76,6 @@ public fun StreetViewPanorama.clickEvents(): Flow * observe panorama long click events will override an existing listener (if any) to * [StreetViewPanorama.setOnStreetViewPanoramaLongClickListener]. */ -@ExperimentalCoroutinesApi public fun StreetViewPanorama.longClickEvents(): Flow = callbackFlow { setOnStreetViewPanoramaLongClickListener {