add user location callback and change user location layer modifier

This commit is contained in:
Dmitry Yurchenko 2023-03-07 18:45:18 +03:00
parent 3b35c16cde
commit 0417ca3e67
1 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,8 @@ import ru.touchin.basemap.AbstractMapManager
@Suppress("detekt.TooManyFunctions") @Suppress("detekt.TooManyFunctions")
class YandexMapManager( class YandexMapManager(
mapView: MapView mapView: MapView,
private val onUserLocationAdded: (() -> Unit)? = null
) : AbstractMapManager<MapView, Map, Point>(mapView), MapLoadedListener, CameraListener, InputListener, UserLocationObjectListener { ) : AbstractMapManager<MapView, Map, Point>(mapView), MapLoadedListener, CameraListener, InputListener, UserLocationObjectListener {
companion object { companion object {
@ -36,7 +37,7 @@ class YandexMapManager(
} }
private val userLocationLayer by lazy { val userLocationLayer by lazy {
MapKitFactory.getInstance().createUserLocationLayer(mapView.mapWindow).also { MapKitFactory.getInstance().createUserLocationLayer(mapView.mapWindow).also {
it.isVisible = false it.isVisible = false
it.setObjectListener(this) it.setObjectListener(this)
@ -158,6 +159,8 @@ class YandexMapManager(
view.pin.setIcon(imageProvider) view.pin.setIcon(imageProvider)
} }
userLocationAccuracyCirceColor?.let(view.accuracyCircle::setFillColor) userLocationAccuracyCirceColor?.let(view.accuracyCircle::setFillColor)
onUserLocationAdded?.invoke()
} }
override fun onObjectUpdated(view: UserLocationView, event: ObjectEvent) = Unit override fun onObjectUpdated(view: UserLocationView, event: ObjectEvent) = Unit