Android Auto: avoid unnecessary location updates

This commit is contained in:
johan12345
2021-09-05 16:47:22 +02:00
parent fd1f05888a
commit b8c8245978
2 changed files with 10 additions and 0 deletions

View File

@@ -214,6 +214,11 @@ class MapScreen(ctx: CarContext, val session: EVMapSession, val favorites: Boole
}
override fun updateLocation(location: Location) {
if (location.latitude == this.location?.latitude
&& location.longitude == this.location?.longitude
) {
return
}
this.location = location
if (updateCoroutine != null) {
// don't update while still loading last update

View File

@@ -64,6 +64,11 @@ class WelcomeScreen(ctx: CarContext, val session: EVMapSession) : Screen(ctx), L
}
override fun updateLocation(location: Location) {
if (location.latitude == this.location?.latitude
&& location.longitude == this.location?.longitude
) {
return
}
this.location = location
invalidate()
}