Skip to content

Commit e260588

Browse files
chore(deps): bump com.ncorti.ktfmt.gradle:plugin from 0.15.1 to 0.21.0 in /android (#203)
* chore(deps): bump com.ncorti.ktfmt.gradle:plugin in /android Bumps com.ncorti.ktfmt.gradle:plugin from 0.15.1 to 0.21.0. --- updated-dependencies: - dependency-name: com.ncorti.ktfmt.gradle:plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * chore: reformat kotlin code with new formatter --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joonas Kerttula <[email protected]>
1 parent 25edf5a commit e260588

25 files changed

+393
-486
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ buildscript {
2626
dependencies {
2727
classpath 'com.android.tools.build:gradle:8.4.0'
2828
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
29-
classpath 'com.ncorti.ktfmt.gradle:plugin:0.15.1'
29+
classpath 'com.ncorti.ktfmt.gradle:plugin:0.21.0'
3030
}
3131
}
3232

android/src/main/kotlin/com/google/maps/flutter/navigation/Convert.kt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ object Convert {
151151
position.bearing.toDouble(),
152152
LatLngDto(position.target.latitude, position.target.longitude),
153153
position.tilt.toDouble(),
154-
position.zoom.toDouble()
154+
position.zoom.toDouble(),
155155
)
156156
}
157157

@@ -166,7 +166,7 @@ object Convert {
166166
convertLatLngFromDto(position.target),
167167
position.zoom.toFloat(),
168168
position.tilt.toFloat(),
169-
position.bearing.toFloat()
169+
position.bearing.toFloat(),
170170
)
171171
}
172172

@@ -184,7 +184,7 @@ object Convert {
184184
focus =
185185
Point(
186186
convertLogicalToScreenPixel(dx, density).toInt(),
187-
convertLogicalToScreenPixel(dy, density).toInt()
187+
convertLogicalToScreenPixel(dy, density).toInt(),
188188
)
189189
}
190190
return focus
@@ -313,7 +313,7 @@ object Convert {
313313
convertLatLngToDto(waypoint.position),
314314
waypoint.placeId,
315315
waypoint.preferSameSideOfRoad,
316-
waypoint.preferredHeading.takeIf { it != -1 }?.toLong()
316+
waypoint.preferredHeading.takeIf { it != -1 }?.toLong(),
317317
)
318318
}
319319

@@ -326,7 +326,7 @@ object Convert {
326326
fun convertTimeAndDistanceToDto(timeAndDistance: TimeAndDistance): NavigationTimeAndDistanceDto {
327327
return NavigationTimeAndDistanceDto(
328328
timeAndDistance.seconds.toDouble(),
329-
timeAndDistance.meters.toDouble()
329+
timeAndDistance.meters.toDouble(),
330330
)
331331
}
332332

@@ -516,11 +516,11 @@ object Convert {
516516
.setSeverityUpgradeDurationSeconds(options.severityUpgradeDurationSeconds)
517517
.setSpeedAlertThresholdPercentage(
518518
SpeedAlertSeverity.MINOR,
519-
options.minorSpeedAlertThresholdPercentage.toFloat()
519+
options.minorSpeedAlertThresholdPercentage.toFloat(),
520520
)
521521
.setSpeedAlertThresholdPercentage(
522522
SpeedAlertSeverity.MAJOR,
523-
options.majorSpeedAlertThresholdPercentage.toFloat()
523+
options.majorSpeedAlertThresholdPercentage.toFloat(),
524524
)
525525
.build()
526526
}
@@ -533,7 +533,7 @@ object Convert {
533533
fun sinkMarkerOptions(
534534
markerOptions: MarkerOptionsDto,
535535
sink: MarkerOptionsSink,
536-
imageRegistry: ImageRegistry
536+
imageRegistry: ImageRegistry,
537537
) {
538538
sink.setAlpha(markerOptions.alpha.toFloat())
539539
sink.setAnchor(markerOptions.anchor.u.toFloat(), markerOptions.anchor.v.toFloat())
@@ -542,7 +542,7 @@ object Convert {
542542
sink.setConsumeTapEvents(markerOptions.consumeTapEvents)
543543
sink.setInfoWindowAnchor(
544544
markerOptions.infoWindow.anchor.u.toFloat(),
545-
markerOptions.infoWindow.anchor.v.toFloat()
545+
markerOptions.infoWindow.anchor.v.toFloat(),
546546
)
547547
sink.setPosition(LatLng(markerOptions.position.latitude, markerOptions.position.longitude))
548548
sink.setRotation(markerOptions.rotation.toFloat())
@@ -584,16 +584,16 @@ object Convert {
584584
// Should never happen, added to suppress compiler warning.
585585
throw FlutterError(
586586
"nullTrafficDataRoadStretchRenderingDataListStyle",
587-
"Traffic data road stretch rendering data list style is null"
587+
"Traffic data road stretch rendering data list style is null",
588588
)
589589
}
590590
}
591591
RouteSegmentTrafficDataRoadStretchRenderingDataDto(
592592
style,
593593
it.lengthMeters.toLong(),
594-
it.offsetMeters.toLong()
594+
it.offsetMeters.toLong(),
595595
)
596-
}
596+
},
597597
)
598598
}
599599

@@ -602,7 +602,7 @@ object Convert {
602602
convertRouteSegmentTrafficDataToDto(segment.trafficData),
603603
LatLngDto(segment.destinationLatLng.latitude, segment.destinationLatLng.longitude),
604604
segment.latLngs.map { LatLngDto(it.latitude, it.longitude) },
605-
convertWaypointToDto(segment.destinationWaypoint)
605+
convertWaypointToDto(segment.destinationWaypoint),
606606
)
607607
}
608608

@@ -614,7 +614,7 @@ object Convert {
614614
fun sinkPolygonOptions(
615615
polygonOptions: PolygonOptionsDto,
616616
sink: PolygonOptionsSink,
617-
density: Float
617+
density: Float,
618618
) {
619619
sink.setPoints(polygonOptions.points.filterNotNull().map { LatLng(it.latitude, it.longitude) })
620620
sink.setHoles(
@@ -650,7 +650,7 @@ object Convert {
650650
strokeWidth = convertScreenToLogicalPixel(polygon.strokeWidth.toDouble(), density),
651651
strokeColor = polygon.strokeColor.toLong(),
652652
visible = polygon.isVisible,
653-
zIndex = polygon.zIndex.toDouble()
653+
zIndex = polygon.zIndex.toDouble(),
654654
)
655655
}
656656

@@ -677,12 +677,12 @@ object Convert {
677677
marker.snippet,
678678
MarkerAnchorDto(
679679
markerController.infoWindowAnchorU.toDouble(),
680-
markerController.infoWindowAnchorV.toDouble()
681-
)
680+
markerController.infoWindowAnchorV.toDouble(),
681+
),
682682
),
683683
visible = marker.isVisible,
684684
zIndex = marker.zIndex.toDouble(),
685-
icon = registeredImageToImageDescriptorDto(markerController.registeredImage)
685+
icon = registeredImageToImageDescriptorDto(markerController.registeredImage),
686686
)
687687
}
688688

@@ -700,7 +700,7 @@ object Convert {
700700
return StyleSpan(
701701
StrokeStyle.gradientBuilder(span.style.fromColor.toInt(), span.style.toColor.toInt())
702702
.build(),
703-
span.length
703+
span.length,
704704
)
705705
}
706706
return null
@@ -785,7 +785,7 @@ object Convert {
785785
timeToCurrentStepSeconds = navInfo.timeToCurrentStepSeconds?.toLong(),
786786
timeToNextDestinationSeconds = navInfo.timeToNextDestinationSeconds?.toLong(),
787787
timeToFinalDestinationSeconds = navInfo.timeToFinalDestinationSeconds?.toLong(),
788-
navState = convertNavState(navInfo.navState)
788+
navState = convertNavState(navInfo.navState),
789789
)
790790
}
791791

@@ -936,7 +936,7 @@ object Convert {
936936
fun sinkPolylineOptions(
937937
polylineOptions: PolylineOptionsDto,
938938
sink: PolylineOptionsSink,
939-
density: Float
939+
density: Float,
940940
) {
941941
if (polylineOptions.points != null) {
942942
sink.setPoints(
@@ -993,7 +993,7 @@ object Convert {
993993
strokePattern = polyline.pattern?.map { convertPatternItem(it) },
994994
visible = polyline.isVisible,
995995
zIndex = polyline.zIndex.toDouble(),
996-
spans = polyline.spans.map { convertStyleSpan(it) }
996+
spans = polyline.spans.map { convertStyleSpan(it) },
997997
)
998998
}
999999

@@ -1031,7 +1031,7 @@ object Convert {
10311031
fillColor = circle.fillColor.toLong(),
10321032
zIndex = circle.zIndex.toDouble(),
10331033
visible = circle.isVisible,
1034-
clickable = circle.isClickable
1034+
clickable = circle.isClickable,
10351035
)
10361036
}
10371037

@@ -1048,7 +1048,7 @@ object Convert {
10481048
registeredImage.imageId,
10491049
registeredImage.imagePixelRatio,
10501050
registeredImage.width,
1051-
registeredImage.height
1051+
registeredImage.height,
10521052
)
10531053
} else {
10541054
// For default marker icon

android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal constructor(
2929
viewId: Int,
3030
viewEventApi: ViewEventApi,
3131
private val viewRegistry: GoogleMapsViewRegistry,
32-
imageRegistry: ImageRegistry
32+
imageRegistry: ImageRegistry,
3333
) : PlatformView, GoogleMapsBaseMapView(viewId, mapOptions, viewEventApi, imageRegistry) {
3434
private val _mapView: MapView = MapView(context, mapOptions)
3535

android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class GoogleMapsBaseMapView(
4141
protected val viewId: Int,
4242
mapOptions: GoogleMapOptions,
4343
protected val viewEventApi: ViewEventApi,
44-
private val imageRegistry: ImageRegistry
44+
private val imageRegistry: ImageRegistry,
4545
) {
4646
companion object {
4747
const val INVALIDATION_FRAME_SKIP_AMOUNT = 4 // Amount of skip frames before invalidation
@@ -105,16 +105,10 @@ abstract class GoogleMapsBaseMapView(
105105

106106
protected open fun initListeners() {
107107
getMap().setOnMapClickListener {
108-
viewEventApi.onMapClickEvent(
109-
viewId.toLong(),
110-
LatLngDto(it.latitude, it.longitude),
111-
) {}
108+
viewEventApi.onMapClickEvent(viewId.toLong(), LatLngDto(it.latitude, it.longitude)) {}
112109
}
113110
getMap().setOnMapLongClickListener {
114-
viewEventApi.onMapLongClickEvent(
115-
viewId.toLong(),
116-
LatLngDto(it.latitude, it.longitude),
117-
) {}
111+
viewEventApi.onMapLongClickEvent(viewId.toLong(), LatLngDto(it.latitude, it.longitude)) {}
118112
}
119113
getMap().setOnMarkerClickListener { marker ->
120114
val markerId = findMarkerId(marker)
@@ -189,15 +183,15 @@ abstract class GoogleMapsBaseMapView(
189183
viewEventApi.onCameraChanged(
190184
viewId.toLong(),
191185
CameraEventTypeDto.ONCAMERASTARTEDFOLLOWINGLOCATION,
192-
Convert.convertCameraPositionToDto(getMap().cameraPosition)
186+
Convert.convertCameraPositionToDto(getMap().cameraPosition),
193187
) {}
194188
}
195189

196190
override fun onCameraStoppedFollowingLocation() {
197191
viewEventApi.onCameraChanged(
198192
viewId.toLong(),
199193
CameraEventTypeDto.ONCAMERASTOPPEDFOLLOWINGLOCATION,
200-
Convert.convertCameraPositionToDto(getMap().cameraPosition)
194+
Convert.convertCameraPositionToDto(getMap().cameraPosition),
201195
) {}
202196
}
203197
}
@@ -284,7 +278,7 @@ abstract class GoogleMapsBaseMapView(
284278
viewId.toLong(),
285279
markerId,
286280
eventType,
287-
LatLngDto(marker.position.latitude, marker.position.longitude)
281+
LatLngDto(marker.position.latitude, marker.position.longitude),
288282
) {}
289283
}
290284

@@ -332,7 +326,7 @@ abstract class GoogleMapsBaseMapView(
332326
if (minZoomPreference > (_maxZoomLevelPreference ?: getMap().maxZoomLevel)) {
333327
throw FlutterError(
334328
"minZoomGreaterThanMaxZoom",
335-
"Minimum zoom level cannot be greater than maximum zoom level"
329+
"Minimum zoom level cannot be greater than maximum zoom level",
336330
)
337331
}
338332

@@ -345,7 +339,7 @@ abstract class GoogleMapsBaseMapView(
345339
if (maxZoomPreference < (_minZoomLevelPreference ?: getMap().minZoomLevel)) {
346340
throw FlutterError(
347341
"maxZoomLessThanMinZoom",
348-
"Maximum zoom level cannot be less than minimum zoom level"
342+
"Maximum zoom level cannot be less than minimum zoom level",
349343
)
350344
}
351345

@@ -427,7 +421,8 @@ abstract class GoogleMapsBaseMapView(
427421
// library for geolocation or implement separate method under
428422
// [GoogleMapsNavigationSessionManager] to fetch the location
429423
// using the [FusedLocationProviderApi].
430-
@Suppress("DEPRECATION") return getMap().myLocation
424+
@Suppress("DEPRECATION")
425+
return getMap().myLocation
431426
}
432427

433428
fun getCameraPosition(): CameraPosition {
@@ -453,7 +448,7 @@ abstract class GoogleMapsBaseMapView(
453448
private fun animateCamera(
454449
cameraUpdate: CameraUpdate,
455450
duration: Long?,
456-
callback: (Result<Boolean>) -> Unit
451+
callback: (Result<Boolean>) -> Unit,
457452
) {
458453
// Native animateCamera() doesn't allow setting null duration so need to do two calls
459454
if (duration == null) {
@@ -466,7 +461,7 @@ abstract class GoogleMapsBaseMapView(
466461
fun animateCameraToCameraPosition(
467462
cameraPosition: CameraPosition,
468463
duration: Long?,
469-
callback: (Result<Boolean>) -> Unit
464+
callback: (Result<Boolean>) -> Unit,
470465
) {
471466
animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), duration, callback)
472467
}
@@ -479,7 +474,7 @@ abstract class GoogleMapsBaseMapView(
479474
bounds: LatLngBounds,
480475
padding: Double,
481476
duration: Long?,
482-
callback: (Result<Boolean>) -> Unit
477+
callback: (Result<Boolean>) -> Unit,
483478
) {
484479
animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding.toInt()), duration, callback)
485480
}
@@ -488,7 +483,7 @@ abstract class GoogleMapsBaseMapView(
488483
point: LatLng,
489484
zoom: Double,
490485
duration: Long?,
491-
callback: (Result<Boolean>) -> Unit
486+
callback: (Result<Boolean>) -> Unit,
492487
) {
493488
animateCamera(CameraUpdateFactory.newLatLngZoom(point, zoom.toFloat()), duration, callback)
494489
}
@@ -497,20 +492,20 @@ abstract class GoogleMapsBaseMapView(
497492
scrollByDx: Double,
498493
scrollByDy: Double,
499494
duration: Long?,
500-
callback: (Result<Boolean>) -> Unit
495+
callback: (Result<Boolean>) -> Unit,
501496
) {
502497
animateCamera(
503498
CameraUpdateFactory.scrollBy(scrollByDx.toFloat(), scrollByDy.toFloat()),
504499
duration,
505-
callback
500+
callback,
506501
)
507502
}
508503

509504
fun animateCameraByZoom(
510505
zoomBy: Double,
511506
focus: Point?,
512507
duration: Long?,
513-
callback: (Result<Boolean>) -> Unit
508+
callback: (Result<Boolean>) -> Unit,
514509
) {
515510
// Native animateCamera() doesn't allow setting null duration or focus so need to split to
516511
// multiple calls
@@ -599,7 +594,7 @@ abstract class GoogleMapsBaseMapView(
599594
Result.failure(
600595
FlutterError(
601596
"mapReadyCallbackAlreadyPending",
602-
"A callback is already pending and cannot be overridden."
597+
"A callback is already pending and cannot be overridden.",
603598
)
604599
)
605600
)
@@ -640,7 +635,7 @@ abstract class GoogleMapsBaseMapView(
640635
it.options.anchor.v.toFloat(),
641636
it.options.infoWindow.anchor.u.toFloat(),
642637
it.options.infoWindow.anchor.v.toFloat(),
643-
registeredImage
638+
registeredImage,
644639
)
645640
_markers.add(controller)
646641
result.add(it)
@@ -709,9 +704,7 @@ abstract class GoogleMapsBaseMapView(
709704
}
710705
}
711706

712-
fun addPolygons(
713-
polygons: List<PolygonDto>,
714-
): List<PolygonDto> {
707+
fun addPolygons(polygons: List<PolygonDto>): List<PolygonDto> {
715708
val density = Resources.getSystem().displayMetrics.density
716709
invalidateViewAfterMapLoad()
717710
val result = mutableListOf<PolygonDto>()
@@ -778,9 +771,7 @@ abstract class GoogleMapsBaseMapView(
778771
}
779772
}
780773

781-
fun addPolylines(
782-
polylines: List<PolylineDto>,
783-
): List<PolylineDto> {
774+
fun addPolylines(polylines: List<PolylineDto>): List<PolylineDto> {
784775
val density = Resources.getSystem().displayMetrics.density
785776
invalidateViewAfterMapLoad()
786777
val result = mutableListOf<PolylineDto>()

0 commit comments

Comments
 (0)