From 80aa03811b775522eedca9767d23885223e2d52d Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 16 Nov 2018 15:56:45 +0100 Subject: [PATCH] StationsActivity: Reduce number of map movements/zooms on activity launch. --- .../oeffi/stations/StationsActivity.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/oeffi/src/de/schildbach/oeffi/stations/StationsActivity.java b/oeffi/src/de/schildbach/oeffi/stations/StationsActivity.java index 7a179ff..f0aaf26 100644 --- a/oeffi/src/de/schildbach/oeffi/stations/StationsActivity.java +++ b/oeffi/src/de/schildbach/oeffi/stations/StationsActivity.java @@ -575,6 +575,8 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware stationList.clearOnScrollListeners(); + handler.removeCallbacksAndMessages(null); + super.onDestroy(); } @@ -1027,8 +1029,13 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware mapView.invalidate(); } - if (added) - mapView.zoomToStations(stations); + if (added) { + handler.postDelayed(new Runnable() { + public void run() { + mapView.zoomToStations(stations); + } + }, 500); + } updateGUI(); } @@ -1482,10 +1489,6 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware final double hereLat = here.getLatitude(); final double hereLon = here.getLongitude(); - - if (deviceLocation == null && fixedLocation == null) - mapView.animateToLocation(hereLat, hereLon); - deviceLocation = Point.fromDouble(hereLat, hereLon); stationListAdapter.setDeviceLocation(here);