From 34a1a7d38868fff0c9b60e2fcd72788635d22c57 Mon Sep 17 00:00:00 2001 From: JSpiner Date: Wed, 16 Oct 2024 13:56:12 +0900 Subject: [PATCH] feat: Rename example codes that were using the position `parameter` to `initialPosition`. #637 --- .../google/maps/android/compose/AccessibilityActivity.kt | 2 +- .../com/google/maps/android/compose/BasicMapActivity.kt | 8 ++++---- .../google/maps/android/compose/MapInColumnActivity.kt | 2 +- .../google/maps/android/compose/RecompositionActivity.kt | 2 +- .../compose/markerexamples/AdvancedMarkersActivity.kt | 8 ++++---- .../compose/markerexamples/MarkerClusteringActivity.kt | 2 +- .../markerdragevents/MarkerDragEventsActivity.kt | 2 +- .../UpdatingNoDragMarkerWithDataModelActivity.kt | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/google/maps/android/compose/AccessibilityActivity.kt b/app/src/main/java/com/google/maps/android/compose/AccessibilityActivity.kt index 3e032238d..fcd2a5462 100644 --- a/app/src/main/java/com/google/maps/android/compose/AccessibilityActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/AccessibilityActivity.kt @@ -37,7 +37,7 @@ class AccessibilityActivity : ComponentActivity() { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { - val singaporeState = rememberMarkerState(position = singapore) + val singaporeState = rememberMarkerState(initialPosition = singapore) val cameraPositionState = rememberCameraPositionState { position = defaultCameraPosition } diff --git a/app/src/main/java/com/google/maps/android/compose/BasicMapActivity.kt b/app/src/main/java/com/google/maps/android/compose/BasicMapActivity.kt index aaf3e47d2..93d1c17b5 100644 --- a/app/src/main/java/com/google/maps/android/compose/BasicMapActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/BasicMapActivity.kt @@ -142,10 +142,10 @@ fun GoogleMapView( mapColorScheme: ComposeMapColorScheme = ComposeMapColorScheme.FOLLOW_SYSTEM, content: @Composable () -> Unit = {} ) { - val singaporeState = rememberMarkerState(position = singapore) - val singapore2State = rememberMarkerState(position = singapore2) - val singapore3State = rememberMarkerState(position = singapore3) - val singapore4State = rememberMarkerState(position = singapore4) + val singaporeState = rememberMarkerState(initialPosition = singapore) + val singapore2State = rememberMarkerState(initialPosition = singapore2) + val singapore3State = rememberMarkerState(initialPosition = singapore3) + val singapore4State = rememberMarkerState(initialPosition = singapore4) var circleCenter by remember { mutableStateOf(singapore) } if (!singaporeState.isDragging) { diff --git a/app/src/main/java/com/google/maps/android/compose/MapInColumnActivity.kt b/app/src/main/java/com/google/maps/android/compose/MapInColumnActivity.kt index 1908df89f..2110ae44e 100644 --- a/app/src/main/java/com/google/maps/android/compose/MapInColumnActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/MapInColumnActivity.kt @@ -185,7 +185,7 @@ private fun GoogleMapViewInColumn( cameraPositionState: CameraPositionState, onMapLoaded: () -> Unit, ) { - val singaporeState = rememberMarkerState(position = singapore) + val singaporeState = rememberMarkerState(initialPosition = singapore) var uiSettings by remember { mutableStateOf(MapUiSettings(compassEnabled = false)) } var mapProperties by remember { diff --git a/app/src/main/java/com/google/maps/android/compose/RecompositionActivity.kt b/app/src/main/java/com/google/maps/android/compose/RecompositionActivity.kt index d0fc8cd50..24df349d0 100644 --- a/app/src/main/java/com/google/maps/android/compose/RecompositionActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/RecompositionActivity.kt @@ -70,7 +70,7 @@ class RecompositionActivity : ComponentActivity() { cameraPositionState: CameraPositionState = rememberCameraPositionState(), content: @Composable () -> Unit = {}, ) { - val markerState = rememberMarkerState(position = singapore) + val markerState = rememberMarkerState(initialPosition = singapore) val uiSettings by remember { mutableStateOf(MapUiSettings(compassEnabled = false)) } val mapProperties by remember { diff --git a/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt b/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt index a78ee674e..e1bd7b17c 100644 --- a/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/markerexamples/AdvancedMarkersActivity.kt @@ -68,10 +68,10 @@ class AdvancedMarkersActivity : ComponentActivity(), OnMapsSdkInitializedCallbac val mapProperties by remember { mutableStateOf(MapProperties(mapType = MapType.NORMAL)) } - val marker1State = rememberMarkerState(position = santiago) - val marker2State = rememberMarkerState(position = bogota) - val marker3State = rememberMarkerState(position = lima) - val marker4State = rememberMarkerState(position = salvador) + val marker1State = rememberMarkerState(initialPosition = santiago) + val marker2State = rememberMarkerState(initialPosition = bogota) + val marker3State = rememberMarkerState(initialPosition = lima) + val marker4State = rememberMarkerState(initialPosition = salvador) // Drawing on the map is accomplished with a child-based API val markerClick: (Marker) -> Boolean = { diff --git a/app/src/main/java/com/google/maps/android/compose/markerexamples/MarkerClusteringActivity.kt b/app/src/main/java/com/google/maps/android/compose/markerexamples/MarkerClusteringActivity.kt index 77ff5cce6..11a669072 100644 --- a/app/src/main/java/com/google/maps/android/compose/markerexamples/MarkerClusteringActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/markerexamples/MarkerClusteringActivity.kt @@ -118,7 +118,7 @@ fun GoogleMapClustering(items: List) { } MarkerInfoWindow( - state = rememberMarkerState(position = singapore), + state = rememberMarkerState(initialPosition = singapore), onClick = { Log.d(TAG, "Non-cluster marker clicked! $it") true diff --git a/app/src/main/java/com/google/maps/android/compose/markerexamples/markerdragevents/MarkerDragEventsActivity.kt b/app/src/main/java/com/google/maps/android/compose/markerexamples/markerdragevents/MarkerDragEventsActivity.kt index 75dcc7993..419d0156f 100644 --- a/app/src/main/java/com/google/maps/android/compose/markerexamples/markerdragevents/MarkerDragEventsActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/markerexamples/markerdragevents/MarkerDragEventsActivity.kt @@ -87,7 +87,7 @@ private fun DraggableMarker( onDrag: (LatLng) -> Unit = {}, onDragEnd: () -> Unit = {} ) { - val markerState = rememberMarkerState(position = singapore) + val markerState = rememberMarkerState(initialPosition = singapore) Marker( state = markerState, diff --git a/app/src/main/java/com/google/maps/android/compose/markerexamples/updatingnodragmarkerwithdatamodel/UpdatingNoDragMarkerWithDataModelActivity.kt b/app/src/main/java/com/google/maps/android/compose/markerexamples/updatingnodragmarkerwithdatamodel/UpdatingNoDragMarkerWithDataModelActivity.kt index 28fd66f88..b5ef65a71 100644 --- a/app/src/main/java/com/google/maps/android/compose/markerexamples/updatingnodragmarkerwithdatamodel/UpdatingNoDragMarkerWithDataModelActivity.kt +++ b/app/src/main/java/com/google/maps/android/compose/markerexamples/updatingnodragmarkerwithdatamodel/UpdatingNoDragMarkerWithDataModelActivity.kt @@ -152,6 +152,6 @@ fun rememberUpdatedMarkerState(position: LatLng): MarkerState = // rememberUpdatedState() uses MutableState, we use MarkerState. // This is more efficient than updating position in an effect, // as we avoid an additional recomposition. - remember { MarkerState(position = position) }.also { + remember { MarkerState(initialPosition = position) }.also { it.position = position }