From e58c5d5e6cef45d54e4a02a94c3056c7e5cc711f Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:06:50 +0900 Subject: [PATCH 01/11] change agp version to build --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b82ae1aa..10d22863 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.10.1" +agp = "8.9.1" core = "1.6.1" kotlin = "2.0.21" From 4dba616f12bdab28023188c7a8533524f9c9bfd2 Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:07:10 +0900 Subject: [PATCH 02/11] Add animation map component --- .../pages/animation/AnimationMapComponent.kt | 49 +++++ .../pages/animation/AnimationMapPage.kt | 64 +++++++ .../pages/animation/AnimationPageViewModel.kt | 176 ++++++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt create mode 100644 example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt create mode 100644 example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt new file mode 100644 index 00000000..164778b9 --- /dev/null +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt @@ -0,0 +1,49 @@ +package com.mapconductor.example.pages.animation + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.key +import androidx.compose.ui.Modifier +import com.mapconductor.core.circle.Circle +import com.mapconductor.core.circle.OnCircleEventHandler +import com.mapconductor.core.map.MapViewState +import com.mapconductor.core.map.OnMapEventHandler +import com.mapconductor.core.marker.Marker +import com.mapconductor.core.marker.OnMarkerEventHandler +import com.mapconductor.example.MapViewContainer + +@Composable +fun AnimationMapComponent( + mapViewState: MapViewState<*>?, + viewModel: AnimationPageViewModel, + modifier: Modifier = Modifier, + onMapClick: OnMapEventHandler = {}, + onMarkerClick: OnMarkerEventHandler = {}, + onCircleClick: OnCircleEventHandler = {}, + onMarkerDrag: OnMarkerEventHandler = {}, +) { + mapViewState?.let { it -> + MapViewContainer( + modifier = modifier, + state = it, + onMapClick = onMapClick, + onMarkerClick = onMarkerClick, + onCircleClick = onCircleClick, + onMarkerDrag = onMarkerDrag, + ) { + // Circle + key(viewModel.circleState.id) { + Circle(viewModel.circleState) + } + + // Center marker (not draggable) + key(viewModel.centerMarker.id) { + Marker(viewModel.centerMarker) + } + + // Edge marker (draggable) + key(viewModel.edgeMarker.id) { + Marker(viewModel.edgeMarker) + } + } + } +} diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt new file mode 100644 index 00000000..51cb9f75 --- /dev/null +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt @@ -0,0 +1,64 @@ +package com.mapconductor.example.pages.animation + +import androidx.compose.foundation.layout.calculateEndPadding +import androidx.compose.foundation.layout.calculateStartPadding +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.LayoutDirection +import androidx.compose.ui.unit.dp +import com.mapconductor.example.R +import com.mapconductor.example.toast.ToastHost +import com.mapconductor.example.ui.DemoMapPageScaffold +import com.mapconductor.example.ui.MessageCard + +@Composable +fun AnimationMapPage( + viewModel: AnimationPageViewModel = AnimationPageViewModelImpl(), + onToggleSidebar: () -> Unit = {}, +) { + DemoMapPageScaffold( + initCameraPosition = viewModel.initCameraPosition, + onToggleSidebar = onToggleSidebar, + onMapViewStateChanged = viewModel::onMapViewChanged, + ) { paddingValues -> + val mapViewState = viewModel.mapViewState.collectAsState() + + AnimationMapComponent( + mapViewState = mapViewState.value, + viewModel = viewModel, + onMapClick = viewModel::onMapClick, + onMarkerClick = viewModel::onMarkerClick, + onCircleClick = viewModel::onCircleClick, + onMarkerDrag = viewModel::onMarkerDrag, + ) + + // Message Card + MessageCard( + modifier = + Modifier + .align(Alignment.BottomStart) + .padding( + bottom = paddingValues.calculateBottomPadding() + 16.dp, + start = paddingValues.calculateStartPadding(LayoutDirection.Ltr) + 16.dp, + end = paddingValues.calculateEndPadding(LayoutDirection.Ltr) + 16.dp, + ), + title = "Messages", + ) { + Text( + text = stringResource(R.string.circle_example_description), + modifier = Modifier.fillMaxSize(), + ) + } + + ToastHost( + messages = viewModel.messages.collectAsState().value, + onDismiss = { viewModel.removeToast(it) }, + ) + } +} diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt new file mode 100644 index 00000000..52a86879 --- /dev/null +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt @@ -0,0 +1,176 @@ +package com.mapconductor.example.pages.animation + +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import androidx.lifecycle.ViewModel +import com.mapconductor.core.circle.CircleClickEvent +import com.mapconductor.core.circle.CircleState +import com.mapconductor.core.features.GeoPoint +import com.mapconductor.core.map.MapCameraPosition +import com.mapconductor.core.map.MapViewState +import com.mapconductor.core.marker.DefaultIcon +import com.mapconductor.core.marker.MarkerAnimation +import com.mapconductor.core.marker.MarkerState +import com.mapconductor.core.spherical.calculatePositionAtDistance +import com.mapconductor.core.spherical.haversineDistance +import com.mapconductor.example.toast.ToastMessage +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow + +interface AnimationPageViewModel { + val initCameraPosition: MapCameraPosition + val mapViewState: StateFlow?> + val messages: StateFlow> + + val circleCenter: GeoPoint + val radiusMeters: Double + val centerMarker: MarkerState + val edgeMarker: MarkerState + val circleState: CircleState + + fun onMapViewChanged(state: MapViewState<*>) + + fun onMarkerClick(clicked: MarkerState) + + fun onMapClick(clicked: GeoPoint) + + fun onCircleClick(event: CircleClickEvent) + + fun onMarkerDrag(dragged: MarkerState) + + fun showToast(text: String) + + fun removeToast(toastMessage: ToastMessage) +} + +class AnimationPageViewModelImpl : + ViewModel(), + AnimationPageViewModel { + private val _messages: MutableStateFlow> = MutableStateFlow(emptyList()) + override val messages: StateFlow> = _messages.asStateFlow() + private val colors: List = + listOf( + Color.Blue.copy(0.2f), + Color.Red.copy(alpha = 0.2f), + Color.Green.copy(alpha = 0.2f), + Color.Cyan.copy(alpha = 0.2f), + Color.LightGray.copy(alpha = 0.2f), + Color.Magenta.copy(alpha = 0.2f), + ) + private var tapIdx = 0 + + override val initCameraPosition = + MapCameraPosition( + position = + GeoPoint.fromLatLong( + latitude = 21.382314, + longitude = -157.933097, + ), + zoom = 12.0, + bearing = 0.0, + tilt = 0.0, + paddings = null, + ) + + override val circleCenter = GeoPoint.fromLatLong(21.382314, -157.933097) + + override val centerMarker = + MarkerState( + id = "center_marker", + position = circleCenter, + icon = + DefaultIcon( + fillColor = Color.Red, + strokeColor = Color.White, + label = "C", + ), + draggable = false, + ) + + private val _edgeMarker: MutableState = + mutableStateOf( + MarkerState( + id = "edge_marker", + position = + calculatePositionAtDistance( + center = circleCenter, + distanceMeters = 1000.0, + bearingDegrees = 90.0, // East + ), + icon = + DefaultIcon( + fillColor = Color.Green, + strokeColor = Color.White, + label = "E", + ), + draggable = true, + ), + ) + override val edgeMarker: MarkerState + get() = _edgeMarker.value + + override val radiusMeters by derivedStateOf { + haversineDistance(circleCenter, _edgeMarker.value.position) + } + + private val _circleState: MutableState = + mutableStateOf( + CircleState( + id = "circle", + center = circleCenter, + radiusMeters = 1000.0, // Initial radius + strokeColor = Color.Blue.copy(alpha = 0.5f), + strokeWidth = 2.dp, + fillColor = this.colors[0], + ), + ) + override val circleState: CircleState + get() = _circleState.value + + private val _mapViewState = MutableStateFlow?>(null) + override val mapViewState: StateFlow?> = _mapViewState.asStateFlow() + + override fun onMapViewChanged(state: MapViewState<*>) { + this._mapViewState.value = state + } + + override fun onMarkerClick(clicked: MarkerState) { + clicked.animation = MarkerAnimation.Bounce + } + + override fun onMapClick(clicked: GeoPoint) { + showToast("Map clicked at: ${clicked.toUrlValue()}") + } + + override fun onCircleClick(event: CircleClickEvent) { + this.tapIdx = (this.tapIdx + 1) % this.colors.size + event.state.fillColor = this.colors[this.tapIdx] + showToast("Circle clicked - Radius: ${radiusMeters.toInt()}m") + } + + override fun onMarkerDrag(dragged: MarkerState) { + _edgeMarker.value.position = dragged.position + + // Update circle radius + _circleState.value.radiusMeters = radiusMeters // haversineDistance(circleCenter, _edgeMarker.value.position) + +// showToast("Radius updated: ${radiusMeters.toInt()}m") + } + + override fun showToast(text: String) { + this._messages.value = this._messages.value + ToastMessage(text = text) + } + + override fun removeToast(toastMessage: ToastMessage) { + this._messages.value = this._messages.value.filter { it != toastMessage } + } + + override fun onCleared() { + super.onCleared() + } +} From ba9af0d49f5f0832cba1db8602e0da17b843ebad Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:07:28 +0900 Subject: [PATCH 03/11] add animation demo route --- .../java/com/mapconductor/example/DemoAppScreen.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt b/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt index 3033ba56..ed4852c5 100644 --- a/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt +++ b/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.core.content.ContextCompat import androidx.lifecycle.viewmodel.compose.viewModel import com.mapconductor.example.navigation.NavigationViewModel +import com.mapconductor.example.pages.animation.AnimationMapPage import com.mapconductor.example.pages.circle.CircleMapPage import com.mapconductor.example.pages.map.flyto.FlyToMapIcons import com.mapconductor.example.pages.map.flyto.FlyToMapPage @@ -68,6 +69,12 @@ fun DemoAppScreen() { icon = Icons.Default.PlayArrow, route = "polyline", ), + SidebarItem( + id = "animation", + title = "Animation ", + icon = Icons.Default.PlayArrow, + route = "animation", + ), // SidebarItem( // id = "examples", // title = "Map Examples", @@ -108,6 +115,11 @@ fun DemoAppScreen() { onToggleSidebar = navigationViewModel::toggleSidebar, ) } + "animation" -> { + AnimationMapPage( + onToggleSidebar = navigationViewModel::toggleSidebar, + ) + } "settings" -> { // Placeholder for settings page Box( From 1a707eabf375b3487e07fbe462d632d081ad9ea1 Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:07:52 +0900 Subject: [PATCH 04/11] fix bounce logic --- .../main/java/com/mapconductor/core/marker/MarkerRenderer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapconductor-core/src/main/java/com/mapconductor/core/marker/MarkerRenderer.kt b/mapconductor-core/src/main/java/com/mapconductor/core/marker/MarkerRenderer.kt index 2bc17899..346faa16 100644 --- a/mapconductor-core/src/main/java/com/mapconductor/core/marker/MarkerRenderer.kt +++ b/mapconductor-core/src/main/java/com/mapconductor/core/marker/MarkerRenderer.kt @@ -226,7 +226,7 @@ abstract class AbstractMarkerRenderer : MarkerRenderer val startLatLng = holder.fromScreenOffset(startPoint) ?: return@onEach - val lng = target.longitude + val lng = t * target.longitude + (1f - t) * startLatLng.longitude val lat = t * target.latitude + (1f - t) * startLatLng.latitude // 現在の座標をマーカーに適用 From 29024d4e0e6e5b5cc1ae00aa95916e67eca1945a Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:13:08 +0900 Subject: [PATCH 05/11] change icon --- .../src/main/java/com/mapconductor/example/DemoAppScreen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt b/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt index ed4852c5..65a24f9f 100644 --- a/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt +++ b/example-app/src/main/java/com/mapconductor/example/DemoAppScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.CheckCircle import androidx.compose.material.icons.filled.Home +import androidx.compose.material.icons.filled.Place import androidx.compose.material.icons.filled.PlayArrow import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -72,7 +73,7 @@ fun DemoAppScreen() { SidebarItem( id = "animation", title = "Animation ", - icon = Icons.Default.PlayArrow, + icon = Icons.Default.Place, route = "animation", ), // SidebarItem( From e3adc3440249602c4d897d9e39ea807112afcad0 Mon Sep 17 00:00:00 2001 From: Masumori Date: Sat, 16 Aug 2025 14:18:45 +0900 Subject: [PATCH 06/11] remove circle --- .../example/pages/animation/AnimationMapComponent.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt index 164778b9..de06249f 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt @@ -30,11 +30,6 @@ fun AnimationMapComponent( onCircleClick = onCircleClick, onMarkerDrag = onMarkerDrag, ) { - // Circle - key(viewModel.circleState.id) { - Circle(viewModel.circleState) - } - // Center marker (not draggable) key(viewModel.centerMarker.id) { Marker(viewModel.centerMarker) From c4f1d0b7ed0cdcb5130e11bf1cd3f628529adfcb Mon Sep 17 00:00:00 2001 From: Masumori Date: Sun, 17 Aug 2025 22:00:55 +0900 Subject: [PATCH 07/11] Refactor: create list of animation and remove unnecessary lines. --- .../pages/animation/AnimationMapComponent.kt | 13 +-- .../pages/animation/AnimationMapPage.kt | 32 ++--- .../pages/animation/AnimationPageViewModel.kt | 109 ++---------------- 3 files changed, 31 insertions(+), 123 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt index de06249f..e1a39d34 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt @@ -3,7 +3,6 @@ package com.mapconductor.example.pages.animation import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.ui.Modifier -import com.mapconductor.core.circle.Circle import com.mapconductor.core.circle.OnCircleEventHandler import com.mapconductor.core.map.MapViewState import com.mapconductor.core.map.OnMapEventHandler @@ -21,7 +20,7 @@ fun AnimationMapComponent( onCircleClick: OnCircleEventHandler = {}, onMarkerDrag: OnMarkerEventHandler = {}, ) { - mapViewState?.let { it -> + mapViewState?.let { MapViewContainer( modifier = modifier, state = it, @@ -30,14 +29,8 @@ fun AnimationMapComponent( onCircleClick = onCircleClick, onMarkerDrag = onMarkerDrag, ) { - // Center marker (not draggable) - key(viewModel.centerMarker.id) { - Marker(viewModel.centerMarker) - } - - // Edge marker (draggable) - key(viewModel.edgeMarker.id) { - Marker(viewModel.edgeMarker) + key(viewModel.bounceMarker.id) { + Marker(viewModel.bounceMarker) } } } diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt index 51cb9f75..180e2fc6 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt @@ -1,19 +1,20 @@ package com.mapconductor.example.pages.animation +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.calculateEndPadding import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp -import com.mapconductor.example.R -import com.mapconductor.example.toast.ToastHost import com.mapconductor.example.ui.DemoMapPageScaffold import com.mapconductor.example.ui.MessageCard @@ -32,10 +33,7 @@ fun AnimationMapPage( AnimationMapComponent( mapViewState = mapViewState.value, viewModel = viewModel, - onMapClick = viewModel::onMapClick, onMarkerClick = viewModel::onMarkerClick, - onCircleClick = viewModel::onCircleClick, - onMarkerDrag = viewModel::onMarkerDrag, ) // Message Card @@ -48,17 +46,21 @@ fun AnimationMapPage( start = paddingValues.calculateStartPadding(LayoutDirection.Ltr) + 16.dp, end = paddingValues.calculateEndPadding(LayoutDirection.Ltr) + 16.dp, ), - title = "Messages", + title = "Animation list", ) { - Text( - text = stringResource(R.string.circle_example_description), + Column( modifier = Modifier.fillMaxSize(), - ) + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + Row { + Button( + modifier = Modifier.weight(1f), + onClick = { viewModel.onMarkerClick(viewModel.bounceMarker) }, + ) { + Text("Bounce") + } + } + } } - - ToastHost( - messages = viewModel.messages.collectAsState().value, - onDismiss = { viewModel.removeToast(it) }, - ) } } diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt index 52a86879..68e5df66 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt @@ -1,22 +1,14 @@ package com.mapconductor.example.pages.animation -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import androidx.lifecycle.ViewModel -import com.mapconductor.core.circle.CircleClickEvent -import com.mapconductor.core.circle.CircleState import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.map.MapCameraPosition import com.mapconductor.core.map.MapViewState import com.mapconductor.core.marker.DefaultIcon import com.mapconductor.core.marker.MarkerAnimation import com.mapconductor.core.marker.MarkerState -import com.mapconductor.core.spherical.calculatePositionAtDistance -import com.mapconductor.core.spherical.haversineDistance import com.mapconductor.example.toast.ToastMessage import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -28,24 +20,11 @@ interface AnimationPageViewModel { val messages: StateFlow> val circleCenter: GeoPoint - val radiusMeters: Double - val centerMarker: MarkerState - val edgeMarker: MarkerState - val circleState: CircleState + val bounceMarker: MarkerState fun onMapViewChanged(state: MapViewState<*>) fun onMarkerClick(clicked: MarkerState) - - fun onMapClick(clicked: GeoPoint) - - fun onCircleClick(event: CircleClickEvent) - - fun onMarkerDrag(dragged: MarkerState) - - fun showToast(text: String) - - fun removeToast(toastMessage: ToastMessage) } class AnimationPageViewModelImpl : @@ -62,7 +41,6 @@ class AnimationPageViewModelImpl : Color.LightGray.copy(alpha = 0.2f), Color.Magenta.copy(alpha = 0.2f), ) - private var tapIdx = 0 override val initCameraPosition = MapCameraPosition( @@ -79,58 +57,23 @@ class AnimationPageViewModelImpl : override val circleCenter = GeoPoint.fromLatLong(21.382314, -157.933097) - override val centerMarker = + private val _bounceMarker = MarkerState( - id = "center_marker", + id = "bounce_marker", position = circleCenter, icon = DefaultIcon( - fillColor = Color.Red, + fillColor = colors[0], strokeColor = Color.White, - label = "C", + label = "B", ), - draggable = false, - ) - - private val _edgeMarker: MutableState = - mutableStateOf( - MarkerState( - id = "edge_marker", - position = - calculatePositionAtDistance( - center = circleCenter, - distanceMeters = 1000.0, - bearingDegrees = 90.0, // East - ), - icon = - DefaultIcon( - fillColor = Color.Green, - strokeColor = Color.White, - label = "E", - ), - draggable = true, - ), + // If the marker is set animation on creating an instance, + // the marker will be animated when the map will be opened. + animation = MarkerAnimation.Bounce, ) - override val edgeMarker: MarkerState - get() = _edgeMarker.value - - override val radiusMeters by derivedStateOf { - haversineDistance(circleCenter, _edgeMarker.value.position) - } - private val _circleState: MutableState = - mutableStateOf( - CircleState( - id = "circle", - center = circleCenter, - radiusMeters = 1000.0, // Initial radius - strokeColor = Color.Blue.copy(alpha = 0.5f), - strokeWidth = 2.dp, - fillColor = this.colors[0], - ), - ) - override val circleState: CircleState - get() = _circleState.value + override val bounceMarker: MarkerState + get() = _bounceMarker private val _mapViewState = MutableStateFlow?>(null) override val mapViewState: StateFlow?> = _mapViewState.asStateFlow() @@ -140,37 +83,7 @@ class AnimationPageViewModelImpl : } override fun onMarkerClick(clicked: MarkerState) { + // When you want to activate the marker, set the animation for the marker. clicked.animation = MarkerAnimation.Bounce } - - override fun onMapClick(clicked: GeoPoint) { - showToast("Map clicked at: ${clicked.toUrlValue()}") - } - - override fun onCircleClick(event: CircleClickEvent) { - this.tapIdx = (this.tapIdx + 1) % this.colors.size - event.state.fillColor = this.colors[this.tapIdx] - showToast("Circle clicked - Radius: ${radiusMeters.toInt()}m") - } - - override fun onMarkerDrag(dragged: MarkerState) { - _edgeMarker.value.position = dragged.position - - // Update circle radius - _circleState.value.radiusMeters = radiusMeters // haversineDistance(circleCenter, _edgeMarker.value.position) - -// showToast("Radius updated: ${radiusMeters.toInt()}m") - } - - override fun showToast(text: String) { - this._messages.value = this._messages.value + ToastMessage(text = text) - } - - override fun removeToast(toastMessage: ToastMessage) { - this._messages.value = this._messages.value.filter { it != toastMessage } - } - - override fun onCleared() { - super.onCleared() - } } From b431222ca84e2b131766f5643053e9908b7736c9 Mon Sep 17 00:00:00 2001 From: Masumori Date: Fri, 29 Aug 2025 15:27:30 +0300 Subject: [PATCH 08/11] fix: animation list --- .../pages/animation/AnimationMapComponent.kt | 6 +- .../pages/animation/AnimationMapPage.kt | 31 ++++++++++- .../pages/animation/AnimationPageViewModel.kt | 55 +++++++++---------- 3 files changed, 60 insertions(+), 32 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt index e1a39d34..cd9bec06 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt @@ -29,8 +29,10 @@ fun AnimationMapComponent( onCircleClick = onCircleClick, onMarkerDrag = onMarkerDrag, ) { - key(viewModel.bounceMarker.id) { - Marker(viewModel.bounceMarker) + viewModel.allMarkers.forEach { marker -> + key(marker.id) { + Marker(marker) + } } } } diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt index 180e2fc6..987d9c1f 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt @@ -55,9 +55,36 @@ fun AnimationMapPage( Row { Button( modifier = Modifier.weight(1f), - onClick = { viewModel.onMarkerClick(viewModel.bounceMarker) }, + onClick = { viewModel.onMarkerClick(viewModel.allMarkers[0]) }, ) { - Text("Bounce") + Text(viewModel.getSpotName(viewModel.allMarkers[0].id)) + } + } + + Row { + Button( + modifier = Modifier.weight(1f), + onClick = { viewModel.onMarkerClick(viewModel.allMarkers[1]) }, + ) { + Text(viewModel.getSpotName(viewModel.allMarkers[1].id)) + } + } + + Row { + Button( + modifier = Modifier.weight(1f), + onClick = { viewModel.onMarkerClick(viewModel.allMarkers[2]) }, + ) { + Text(viewModel.getSpotName(viewModel.allMarkers[2].id)) + } + } + + Row { + Button( + modifier = Modifier.weight(1f), + onClick = { viewModel.onMarkerClick(viewModel.allMarkers[3]) }, + ) { + Text(viewModel.getSpotName(viewModel.allMarkers[3].id)) } } } diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt index 68e5df66..7731250a 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt @@ -1,5 +1,6 @@ package com.mapconductor.example.pages.animation +import android.util.Log import androidx.compose.runtime.getValue import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel @@ -13,17 +14,27 @@ import com.mapconductor.example.toast.ToastMessage import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import java.io.Serializable +import java.util.NoSuchElementException + +private data class Spot(val id: String, val name: String, val point: GeoPoint) +private val exampleSpots = listOf( + Spot("s1", "Honolulu", GeoPoint.fromLatLong(21.3069, -157.8583)), + Spot("s2", "Waikiki Beach", GeoPoint.fromLatLong(21.2766, -157.8289)), + Spot("s3", "Pearl Harbor", GeoPoint.fromLatLong(21.3649, -157.9491)), + Spot("s4", "Mililani", GeoPoint.fromLatLong(21.4513, -158.0152)), +) interface AnimationPageViewModel { val initCameraPosition: MapCameraPosition val mapViewState: StateFlow?> val messages: StateFlow> + val allMarkers: List val circleCenter: GeoPoint - val bounceMarker: MarkerState + fun getSpotName(markerId: String): String fun onMapViewChanged(state: MapViewState<*>) - fun onMarkerClick(clicked: MarkerState) } @@ -32,15 +43,6 @@ class AnimationPageViewModelImpl : AnimationPageViewModel { private val _messages: MutableStateFlow> = MutableStateFlow(emptyList()) override val messages: StateFlow> = _messages.asStateFlow() - private val colors: List = - listOf( - Color.Blue.copy(0.2f), - Color.Red.copy(alpha = 0.2f), - Color.Green.copy(alpha = 0.2f), - Color.Cyan.copy(alpha = 0.2f), - Color.LightGray.copy(alpha = 0.2f), - Color.Magenta.copy(alpha = 0.2f), - ) override val initCameraPosition = MapCameraPosition( @@ -49,7 +51,7 @@ class AnimationPageViewModelImpl : latitude = 21.382314, longitude = -157.933097, ), - zoom = 12.0, + zoom = 9.0, bearing = 0.0, tilt = 0.0, paddings = null, @@ -57,33 +59,30 @@ class AnimationPageViewModelImpl : override val circleCenter = GeoPoint.fromLatLong(21.382314, -157.933097) - private val _bounceMarker = - MarkerState( - id = "bounce_marker", - position = circleCenter, - icon = - DefaultIcon( - fillColor = colors[0], - strokeColor = Color.White, - label = "B", - ), - // If the marker is set animation on creating an instance, - // the marker will be animated when the map will be opened. - animation = MarkerAnimation.Bounce, + private val markers: Map = exampleSpots.associate { spot -> + spot.id to MarkerState( + id = "marker_${spot.id}", + position = spot.point, + icon = DefaultIcon(label = spot.name.first().uppercase()), + animation = null ) - - override val bounceMarker: MarkerState - get() = _bounceMarker + } + override val allMarkers: List get() = markers.values.toList() private val _mapViewState = MutableStateFlow?>(null) override val mapViewState: StateFlow?> = _mapViewState.asStateFlow() + override fun getSpotName(markerId: String): String = + exampleSpots.firstOrNull { "marker_${it.id}" == markerId }?.name + ?: throw NoSuchElementException("Spot not found: $markerId") + override fun onMapViewChanged(state: MapViewState<*>) { this._mapViewState.value = state } override fun onMarkerClick(clicked: MarkerState) { // When you want to activate the marker, set the animation for the marker. + Log.i("AnimationPageViewModelImpl", "onMarkerClick: ${clicked.id}") clicked.animation = MarkerAnimation.Bounce } } From 3c9870167c020ea745ff5fc0a635de6c13050555 Mon Sep 17 00:00:00 2001 From: Masumori Date: Fri, 29 Aug 2025 15:30:19 +0300 Subject: [PATCH 09/11] refactor: columns --- .../pages/animation/AnimationMapPage.kt | 41 ++++--------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt index 987d9c1f..d404c60e 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapPage.kt @@ -52,39 +52,14 @@ fun AnimationMapPage( modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp), ) { - Row { - Button( - modifier = Modifier.weight(1f), - onClick = { viewModel.onMarkerClick(viewModel.allMarkers[0]) }, - ) { - Text(viewModel.getSpotName(viewModel.allMarkers[0].id)) - } - } - - Row { - Button( - modifier = Modifier.weight(1f), - onClick = { viewModel.onMarkerClick(viewModel.allMarkers[1]) }, - ) { - Text(viewModel.getSpotName(viewModel.allMarkers[1].id)) - } - } - - Row { - Button( - modifier = Modifier.weight(1f), - onClick = { viewModel.onMarkerClick(viewModel.allMarkers[2]) }, - ) { - Text(viewModel.getSpotName(viewModel.allMarkers[2].id)) - } - } - - Row { - Button( - modifier = Modifier.weight(1f), - onClick = { viewModel.onMarkerClick(viewModel.allMarkers[3]) }, - ) { - Text(viewModel.getSpotName(viewModel.allMarkers[3].id)) + viewModel.allMarkers.forEach { marker -> + Row { + Button( + modifier = Modifier.weight(1f), + onClick = { viewModel.onMarkerClick(marker) }, + ) { + Text(viewModel.getSpotName(marker.id)) + } } } } From e745912c2643c35159e7eb14c570b9a3126d0c4c Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Thu, 4 Sep 2025 19:10:09 +0900 Subject: [PATCH 10/11] set gradle version 8.10.1 --- .../pages/animation/AnimationMapComponent.kt | 5 +- .../pages/animation/AnimationPageViewModel.kt | 59 ++++++++++++------- gradle/libs.versions.toml | 2 +- .../com/mapconductor/settings/Settings.kt | 2 +- .../arcgis/marker/ArcGISMarkerRenderer.kt | 4 +- 5 files changed, 45 insertions(+), 27 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt index cd9bec06..8fccfe6d 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationMapComponent.kt @@ -1,7 +1,6 @@ package com.mapconductor.example.pages.animation import androidx.compose.runtime.Composable -import androidx.compose.runtime.key import androidx.compose.ui.Modifier import com.mapconductor.core.circle.OnCircleEventHandler import com.mapconductor.core.map.MapViewState @@ -30,9 +29,7 @@ fun AnimationMapComponent( onMarkerDrag = onMarkerDrag, ) { viewModel.allMarkers.forEach { marker -> - key(marker.id) { - Marker(marker) - } + Marker(marker) } } } diff --git a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt index 7731250a..33dd422b 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/animation/AnimationPageViewModel.kt @@ -1,8 +1,6 @@ package com.mapconductor.example.pages.animation -import android.util.Log import androidx.compose.runtime.getValue -import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.map.MapCameraPosition @@ -11,20 +9,35 @@ import com.mapconductor.core.marker.DefaultIcon import com.mapconductor.core.marker.MarkerAnimation import com.mapconductor.core.marker.MarkerState import com.mapconductor.example.toast.ToastMessage +import java.util.NoSuchElementException +import android.util.Log import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow -import java.io.Serializable -import java.util.NoSuchElementException -private data class Spot(val id: String, val name: String, val point: GeoPoint) -private val exampleSpots = listOf( - Spot("s1", "Honolulu", GeoPoint.fromLatLong(21.3069, -157.8583)), - Spot("s2", "Waikiki Beach", GeoPoint.fromLatLong(21.2766, -157.8289)), - Spot("s3", "Pearl Harbor", GeoPoint.fromLatLong(21.3649, -157.9491)), - Spot("s4", "Mililani", GeoPoint.fromLatLong(21.4513, -158.0152)), +private data class Spot( + val id: String, + val name: String, + val animation: MarkerAnimation, + val point: GeoPoint, ) +private val exampleSpots = + listOf( + Spot( + id = "s1", + name = "Bounce", + animation = MarkerAnimation.Bounce, + point = GeoPoint.fromLatLong(21.3069, -157.8583), + ), + Spot( + id = "s2", + name = "Drop", + animation = MarkerAnimation.Drop, + point = GeoPoint.fromLatLong(21.4513, -158.0152), + ), + ) + interface AnimationPageViewModel { val initCameraPosition: MapCameraPosition val mapViewState: StateFlow?> @@ -34,7 +47,9 @@ interface AnimationPageViewModel { val circleCenter: GeoPoint fun getSpotName(markerId: String): String + fun onMapViewChanged(state: MapViewState<*>) + fun onMarkerClick(clicked: MarkerState) } @@ -59,21 +74,23 @@ class AnimationPageViewModelImpl : override val circleCenter = GeoPoint.fromLatLong(21.382314, -157.933097) - private val markers: Map = exampleSpots.associate { spot -> - spot.id to MarkerState( - id = "marker_${spot.id}", - position = spot.point, - icon = DefaultIcon(label = spot.name.first().uppercase()), - animation = null - ) - } + private val markers: Map = + exampleSpots.associate { spot -> + spot.id to + MarkerState( + id = spot.id, + position = spot.point, + icon = DefaultIcon(label = spot.name), + animation = null, + ) + } override val allMarkers: List get() = markers.values.toList() private val _mapViewState = MutableStateFlow?>(null) override val mapViewState: StateFlow?> = _mapViewState.asStateFlow() override fun getSpotName(markerId: String): String = - exampleSpots.firstOrNull { "marker_${it.id}" == markerId }?.name + exampleSpots.firstOrNull { it.id == markerId }?.name ?: throw NoSuchElementException("Spot not found: $markerId") override fun onMapViewChanged(state: MapViewState<*>) { @@ -83,6 +100,8 @@ class AnimationPageViewModelImpl : override fun onMarkerClick(clicked: MarkerState) { // When you want to activate the marker, set the animation for the marker. Log.i("AnimationPageViewModelImpl", "onMarkerClick: ${clicked.id}") - clicked.animation = MarkerAnimation.Bounce + + val spot = exampleSpots.firstOrNull { it.id == clicked.id } + clicked.animation = spot?.animation } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 10d22863..b82ae1aa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.9.1" +agp = "8.10.1" core = "1.6.1" kotlin = "2.0.21" diff --git a/mapconductor-core/src/main/java/com/mapconductor/settings/Settings.kt b/mapconductor-core/src/main/java/com/mapconductor/settings/Settings.kt index 939789fb..558976e8 100644 --- a/mapconductor-core/src/main/java/com/mapconductor/settings/Settings.kt +++ b/mapconductor-core/src/main/java/com/mapconductor/settings/Settings.kt @@ -13,7 +13,7 @@ sealed class Settings( ) { object Default : Settings( tapTolerance = 14.dp, - markerDropAnimateDuration = 100, + markerDropAnimateDuration = 300, markerBounceAnimateDuration = 2000, iconSize = MarkerIconSize.Regular, iconStroke = 1.dp, diff --git a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/marker/ArcGISMarkerRenderer.kt b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/marker/ArcGISMarkerRenderer.kt index 8fb2203c..45759e64 100644 --- a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/marker/ArcGISMarkerRenderer.kt +++ b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/marker/ArcGISMarkerRenderer.kt @@ -50,7 +50,9 @@ class ArcGISMarkerRenderer( markerEntity: MarkerEntity, position: GeoPoint, ) { - markerEntity.marker.geometry = position.toPoint(holder.map.scene?.spatialReference) + coroutine.launch { + markerEntity.marker.geometry = position.toPoint(holder.map.scene?.spatialReference) + } } override suspend fun addIcons(newMarkers: List>): List { From d6826097bfd916c060077e2c9e314ffd56aa992d Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Thu, 4 Sep 2025 19:20:46 +0900 Subject: [PATCH 11/11] fix: linter errors --- .../pages/mapDesign/MapDesignPageViewModel.kt | 14 ++++++++++---- .../com/mapconductor/core/map/MapViewState.kt | 4 +--- .../arcgis/ArcGISMapViewController.kt | 16 ++++++---------- .../mapconductor/arcgis/ArcGisMapViewState.kt | 4 +--- .../googlemaps/GoogleMapViewController.kt | 16 ++++++---------- .../googlemaps/GoogleMapViewState.kt | 5 +---- .../mapconductor/here/HereMapViewController.kt | 10 +++------- .../com/mapconductor/here/HereMapViewState.kt | 5 +---- .../mapbox/MapboxMapViewController.kt | 9 ++------- 9 files changed, 31 insertions(+), 52 deletions(-) diff --git a/example-app/src/main/java/com/mapconductor/example/pages/mapDesign/MapDesignPageViewModel.kt b/example-app/src/main/java/com/mapconductor/example/pages/mapDesign/MapDesignPageViewModel.kt index a0f5ed07..495a8b02 100644 --- a/example-app/src/main/java/com/mapconductor/example/pages/mapDesign/MapDesignPageViewModel.kt +++ b/example-app/src/main/java/com/mapconductor/example/pages/mapDesign/MapDesignPageViewModel.kt @@ -179,10 +179,16 @@ class MapDesignPageViewModelImpl : MapDesignOptions(label = "HumanGeographyLabels", design = ArcGISDesign.Companion.HumanGeographyLabels), MapDesignOptions(label = "HumanGeographyDark", design = ArcGISDesign.Companion.HumanGeographyDark), MapDesignOptions(label = "HumanGeographyDarkBase", design = ArcGISDesign.Companion.HumanGeographyDarkBase), - MapDesignOptions(label = "HumanGeographyDarkDetail", design = - ArcGISDesign.Companion.HumanGeographyDarkDetail), - MapDesignOptions(label = "HumanGeographyDarkLabels", design = - ArcGISDesign.Companion.HumanGeographyDarkLabels), + MapDesignOptions( + label = "HumanGeographyDarkDetail", + design = + ArcGISDesign.Companion.HumanGeographyDarkDetail, + ), + MapDesignOptions( + label = "HumanGeographyDarkLabels", + design = + ArcGISDesign.Companion.HumanGeographyDarkLabels, + ), MapDesignOptions(label = "Outdoor", design = ArcGISDesign.Companion.Outdoor), MapDesignOptions(label = "OsmStandard", design = ArcGISDesign.Companion.OsmStandard), MapDesignOptions(label = "OsmStandardRelief", design = ArcGISDesign.Companion.OsmStandardRelief), diff --git a/mapconductor-core/src/main/java/com/mapconductor/core/map/MapViewState.kt b/mapconductor-core/src/main/java/com/mapconductor/core/map/MapViewState.kt index e22ccd79..109c5438 100644 --- a/mapconductor-core/src/main/java/com/mapconductor/core/map/MapViewState.kt +++ b/mapconductor-core/src/main/java/com/mapconductor/core/map/MapViewState.kt @@ -32,9 +32,7 @@ interface MapViewState { fun resetInitState() - fun changeMapDesignType( - value: ActualMapDesignType - ) + fun changeMapDesignType(value: ActualMapDesignType) fun moveCameraTo( cameraPosition: MapCameraPosition, diff --git a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGISMapViewController.kt b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGISMapViewController.kt index f982460d..3a672bc7 100644 --- a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGISMapViewController.kt +++ b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGISMapViewController.kt @@ -1,5 +1,6 @@ package com.mapconductor.arcgis +import com.arcgismaps.mapping.Basemap import com.arcgismaps.mapping.view.Graphic import com.arcgismaps.mapping.view.GraphicsOverlay import com.arcgismaps.mapping.view.LongPressEvent @@ -44,7 +45,6 @@ import android.view.MotionEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import com.arcgismaps.mapping.Basemap interface IArcGISMapViewController : MapViewController< @@ -53,9 +53,7 @@ interface IArcGISMapViewController : ArcGISActualPolyline, ArcGISActualPolygon, > { - fun changeMapDesign( - value: String - ) + fun changeMapDesign(value: String) fun moveCamera( dstPosition: MapCameraPosition, @@ -344,16 +342,14 @@ class ArcGISMapViewController( override suspend fun updateCircle(state: CircleState) = circleOverlayManager.updateCircle(state) - override fun changeMapDesign( - value: String - ){ + override fun changeMapDesign(value: String) { coroutine.launch { holder.map.scene!!.setBasemap( Basemap( ArcGISDesign.toBasemapStyle( - ArcGISDesign(value) - ) - ) + ArcGISDesign(value), + ), + ), ) } } diff --git a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGisMapViewState.kt b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGisMapViewState.kt index 63e58f6e..01739a96 100644 --- a/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGisMapViewState.kt +++ b/mapconductor-for-arcgis/src/main/java/com/mapconductor/arcgis/ArcGisMapViewState.kt @@ -9,7 +9,6 @@ import com.mapconductor.core.map.BaseMapViewSaver import com.mapconductor.core.map.IMapCameraPosition import com.mapconductor.core.map.InitState import com.mapconductor.core.map.MapCameraPosition -import com.mapconductor.core.map.MapDesignType import com.mapconductor.core.map.MapPaddings import com.mapconductor.core.map.MapPaddingsImpl import com.mapconductor.core.map.MapViewState @@ -27,8 +26,7 @@ class ArcGISMapViewState( override val id: String, override val initCameraPosition: MapCameraPosition, override var mapDesignType: ArcGISDesign, -) : MapViewStateImpl() - { +) : MapViewStateImpl() { // Map padding private val _padding = MutableStateFlow(MapPaddingsImpl.Zeros) val padding: StateFlow = _padding.asStateFlow() diff --git a/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewController.kt b/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewController.kt index c103e27c..3151b6fc 100644 --- a/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewController.kt +++ b/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewController.kt @@ -56,9 +56,7 @@ import kotlinx.coroutines.launch interface IGoogleMapViewController : MapViewController, GroundImageCapable { - fun changeMapDesign( - value: Int - ) + fun changeMapDesign(value: Int) fun moveCamera( dstPosition: MapCameraPosition, @@ -86,10 +84,10 @@ class GoogleMapViewController( private val circleRendererFactory: CircleRendererFactory = DefaultGoogleMapCircleRenderer(), private val groundImageController: GroundImageController, ) : BaseMapViewController< - ActualGoogleMapMarker, - ActualGoogleMapCircle, - ActualGoogleMapPolyline, - ActualGoogleMapPolygon, + ActualGoogleMapMarker, + ActualGoogleMapCircle, + ActualGoogleMapPolyline, + ActualGoogleMapPolygon, >(), IGoogleMapViewController, OnCameraMoveStartedListener, @@ -180,9 +178,7 @@ class GoogleMapViewController( holder.map.setOnMarkerDragListener(this) } - override fun changeMapDesign( - value: Int - ){ + override fun changeMapDesign(value: Int) { coroutine.launch { holder.map.mapType = value } diff --git a/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewState.kt b/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewState.kt index ebd9fb1b..d1da3939 100644 --- a/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewState.kt +++ b/mapconductor-for-googlemaps/src/main/java/com/mapconductor/googlemaps/GoogleMapViewState.kt @@ -12,7 +12,6 @@ import com.mapconductor.core.map.MapCameraPosition import com.mapconductor.core.map.MapPaddingsImpl import com.mapconductor.core.map.MapViewState import com.mapconductor.core.map.MapViewStateImpl -import com.mapconductor.core.state.StateOrValue import java.util.UUID import android.os.Bundle import kotlinx.coroutines.flow.MutableStateFlow @@ -37,9 +36,7 @@ class GoogleMapViewState( internal var controller: IGoogleMapViewController? = null - override fun changeMapDesignType( - value: GoogleMapDesign, - ){ + override fun changeMapDesignType(value: GoogleMapDesign) { this.mapDesignType = value this.controller?.changeMapDesign(value.getValue()) } diff --git a/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewController.kt b/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewController.kt index 14fe1520..b8f839a7 100644 --- a/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewController.kt +++ b/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewController.kt @@ -56,9 +56,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch interface IHereMapViewController : MapViewController { - fun changeMapDesign( - value: MapScheme - ) + fun changeMapDesign(value: MapScheme) fun moveCamera( dstPosition: MapCameraPosition, @@ -200,11 +198,9 @@ class HereMapViewController( holder.mapView.gestures.longPressListener = this } - override fun changeMapDesign( - value: MapScheme - ){ + override fun changeMapDesign(value: MapScheme) { coroutine.launch { - holder.mapView.mapScene.loadScene(value){} + holder.mapView.mapScene.loadScene(value) {} } } diff --git a/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewState.kt b/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewState.kt index dab6aed3..397257be 100644 --- a/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewState.kt +++ b/mapconductor-for-here/src/main/java/com/mapconductor/here/HereMapViewState.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable -import com.here.sdk.mapview.MapScheme import com.mapconductor.core.features.GeoPoint import com.mapconductor.core.map.BaseMapViewSaver import com.mapconductor.core.map.IMapCameraPosition @@ -38,9 +37,7 @@ class HereMapViewState( private val _cameraPosition = MutableStateFlow(initCameraPosition) override val cameraPosition: StateFlow = _cameraPosition.asStateFlow() - override fun changeMapDesignType( - value: HereMapDesignType - ) { + override fun changeMapDesignType(value: HereMapDesignType) { this.mapDesignType = value this.controller?.changeMapDesign(value.getValue()) } diff --git a/mapconductor-for-mapbox/src/main/java/com/mapconductor/mapbox/MapboxMapViewController.kt b/mapconductor-for-mapbox/src/main/java/com/mapconductor/mapbox/MapboxMapViewController.kt index 6c61525f..94f9cbd4 100644 --- a/mapconductor-for-mapbox/src/main/java/com/mapconductor/mapbox/MapboxMapViewController.kt +++ b/mapconductor-for-mapbox/src/main/java/com/mapconductor/mapbox/MapboxMapViewController.kt @@ -66,10 +66,7 @@ interface IMapboxMapViewController : MapboxActualPolyline, MapboxActualPolygon, > { - - fun changeMapDesign( - value: String - ) + fun changeMapDesign(value: String) fun moveCamera( dstPosition: MapCameraPosition, @@ -265,9 +262,7 @@ internal class MapboxMapViewController( } } - override fun changeMapDesign( - value: String - ){ + override fun changeMapDesign(value: String) { coroutine.launch { holder.mapView.mapboxMap.loadStyle(value) {} }