Bimba.git

commit e056a460a0adc2459802f0856a6c27be85a5852c

Author: Adam <git@apiote.xyz>

glide to vehicle on minimap

 app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt | 22 


diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt b/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
index 35f871c5fc86be2a7acbee7525b3d45496e97c2e..152bd5c132ed4bc760c74e25d8a3abcb50f2abbe 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
@@ -206,14 +206,20 @@ 				if (departure.vehicle.Position.isZero()) {
 					map.visibility = View.GONE
 					return@let
 				}
-				map.controller.apply { // todo[3.1] glide to centre, not jump
-					setZoom(19.0f.toDouble())
-					setCenter(
-						GeoPoint(
-							departure.vehicle.location().latitude,
-							departure.vehicle.location().longitude
-						)
-					)
+				map.controller.apply {
+					GeoPoint(
+						departure.vehicle.location().latitude,
+						departure.vehicle.location().longitude
+					).let {
+						if (updating) {
+							animateTo(
+								it, 19.0f.toDouble(), 3 * 1000
+							)
+						} else {
+							setCenter(it)
+							setZoom(19f.toDouble())
+						}
+					}
 				}
 
 				map.overlays.removeAll { marker ->