Skip to content

Commit

Permalink
feat: Bump Kotlin and coroutines to 1.6 (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
arriolac committed Mar 30, 2022
1 parent 8d1577e commit d794acf
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 36 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ android {
}

kotlinOptions {
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
jvmTarget = "1.8"
}
}
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
21 changes: 0 additions & 21 deletions maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
)
Expand Down Expand Up @@ -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<Unit> =
callbackFlow {
setOnCameraIdleListener {
Expand All @@ -171,7 +168,6 @@ public fun GoogleMap.cameraIdleEvents(): Flow<Unit> =
* cancel events will override an existing listener (if any) to
* [GoogleMap.setOnCameraMoveCanceledListener].
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.cameraMoveCanceledEvents(): Flow<Unit> =
callbackFlow {
setOnCameraMoveCanceledListener {
Expand All @@ -186,7 +182,6 @@ public fun GoogleMap.cameraMoveCanceledEvents(): Flow<Unit> =
* 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<Unit> =
callbackFlow {
setOnCameraMoveListener {
Expand All @@ -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<Int> =
callbackFlow {
setOnCameraMoveStartedListener {
Expand All @@ -228,7 +222,6 @@ public fun GoogleMap.cameraMoveStartedEvents(): Flow<Int> =
* 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<Circle> =
callbackFlow {
setOnCircleClickListener {
Expand All @@ -244,7 +237,6 @@ public fun GoogleMap.circleClickEvents(): Flow<Circle> =
* clicks events will override an existing listener (if any) to
* [GoogleMap.setOnGroundOverlayClickListener].
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.groundOverlayClicks(): Flow<GroundOverlay> =
callbackFlow {
setOnGroundOverlayClickListener {
Expand All @@ -260,7 +252,6 @@ public fun GoogleMap.groundOverlayClicks(): Flow<GroundOverlay> =
* change events will override an existing listener (if any) to
* [GoogleMap.setOnIndoorStateChangeListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.indoorStateChangeEvents(): Flow<IndoorChangeEvent> =
callbackFlow {
setOnIndoorStateChangeListener(object : GoogleMap.OnIndoorStateChangeListener {
Expand All @@ -282,7 +273,6 @@ public fun GoogleMap.indoorStateChangeEvents(): Flow<IndoorChangeEvent> =
* info window clicks will override an existing listener (if any) to
* [GoogleMap.setOnInfoWindowClickListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.infoWindowClickEvents(): Flow<Marker> =
callbackFlow {
setOnInfoWindowClickListener {
Expand All @@ -298,7 +288,6 @@ public fun GoogleMap.infoWindowClickEvents(): Flow<Marker> =
* window closes will override an existing listener (if any) to
* [GoogleMap.setOnInfoWindowCloseListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.infoWindowCloseEvents(): Flow<Marker> =
callbackFlow {
setOnInfoWindowCloseListener {
Expand All @@ -314,7 +303,6 @@ public fun GoogleMap.infoWindowCloseEvents(): Flow<Marker> =
* window long presses will override an existing listener (if any) to
* [GoogleMap.setOnInfoWindowLongClickListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.infoWindowLongClickEvents(): Flow<Marker> =
callbackFlow {
setOnInfoWindowLongClickListener {
Expand All @@ -329,7 +317,6 @@ public fun GoogleMap.infoWindowLongClickEvents(): Flow<Marker> =
* 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<LatLng> =
callbackFlow {
setOnMapClickListener {
Expand All @@ -344,7 +331,6 @@ public fun GoogleMap.mapClickEvents(): Flow<LatLng> =
* 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<LatLng> =
callbackFlow {
setOnMapLongClickListener {
Expand All @@ -359,7 +345,6 @@ public fun GoogleMap.mapLongClickEvents(): Flow<LatLng> =
* 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<Marker> =
callbackFlow {
setOnMarkerClickListener {
Expand All @@ -374,7 +359,6 @@ public fun GoogleMap.markerClickEvents(): Flow<Marker> =
* 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<OnMarkerDragEvent> =
callbackFlow {
setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener {
Expand All @@ -401,7 +385,6 @@ public fun GoogleMap.markerDragEvents(): Flow<OnMarkerDragEvent> =
* location button click events will override an existing listener (if any) to
* [GoogleMap.setOnMyLocationButtonClickListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.myLocationButtonClickEvents(): Flow<Unit> =
callbackFlow {
setOnMyLocationButtonClickListener {
Expand All @@ -417,7 +400,6 @@ public fun GoogleMap.myLocationButtonClickEvents(): Flow<Unit> =
* location blue dot click events will override an existing listener (if any) to
* [GoogleMap.setOnMyLocationClickListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.myLocationClickEvents(): Flow<Location> =
callbackFlow {
setOnMyLocationClickListener {
Expand All @@ -433,7 +415,6 @@ public fun GoogleMap.myLocationClickEvents(): Flow<Location> =
* PointOfInterest click events will override an existing listener (if any) to
* [GoogleMap.setOnPoiClickListener]
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.poiClickEvents(): Flow<PointOfInterest> =
callbackFlow {
setOnPoiClickListener {
Expand All @@ -448,7 +429,6 @@ public fun GoogleMap.poiClickEvents(): Flow<PointOfInterest> =
* 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<Polygon> =
callbackFlow {
setOnPolygonClickListener {
Expand All @@ -463,7 +443,6 @@ public fun GoogleMap.polygonClickEvents(): Flow<Polygon> =
* 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<Polyline> =
callbackFlow {
setOnPolylineClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<StreetViewPanoramaCamera> =
callbackFlow {
setOnStreetViewPanoramaCameraChangeListener {
Expand All @@ -48,7 +46,6 @@ public fun StreetViewPanorama.cameraChangeEvents(): Flow<StreetViewPanoramaCamer
* observe panorama load change events will override an existing listener (if any) to
* [StreetViewPanorama.setOnStreetViewPanoramaChangeListener].
*/
@ExperimentalCoroutinesApi
public fun StreetViewPanorama.changeEvents(): Flow<StreetViewPanoramaLocation> =
callbackFlow {
setOnStreetViewPanoramaChangeListener {
Expand All @@ -64,7 +61,6 @@ public fun StreetViewPanorama.changeEvents(): Flow<StreetViewPanoramaLocation> =
* observe panorama click events will override an existing listener (if any) to
* [StreetViewPanorama.setOnStreetViewPanoramaClickListener].
*/
@ExperimentalCoroutinesApi
public fun StreetViewPanorama.clickEvents(): Flow<StreetViewPanoramaOrientation> =
callbackFlow {
setOnStreetViewPanoramaClickListener {
Expand All @@ -80,7 +76,6 @@ public fun StreetViewPanorama.clickEvents(): Flow<StreetViewPanoramaOrientation>
* observe panorama long click events will override an existing listener (if any) to
* [StreetViewPanorama.setOnStreetViewPanoramaLongClickListener].
*/
@ExperimentalCoroutinesApi
public fun StreetViewPanorama.longClickEvents(): Flow<StreetViewPanoramaOrientation> =
callbackFlow {
setOnStreetViewPanoramaLongClickListener {
Expand Down

0 comments on commit d794acf

Please sign in to comment.