altosdroid: Redraw offline map when my location changes
authorKeith Packard <keithp@keithp.com>
Fri, 22 Apr 2016 22:52:42 +0000 (18:52 -0400)
committerKeith Packard <keithp@keithp.com>
Fri, 22 Apr 2016 22:52:42 +0000 (18:52 -0400)
Update the map view even if there isn't any current telemetry data.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java

index ff9d0a77d5a4b552a348e0ddb2190955b7c6c461..6edc87a5c381ddd50438a560c83643d4cc89e5e1 100644 (file)
@@ -441,6 +441,8 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
        }
 
        public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) {
+               boolean changed = false;
+
                if (state != null) {
                        map.show(state, null);
                        if (state.pad_lat != AltosLib.MISSING && pad == null)
@@ -479,7 +481,12 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                        }
                }
                if (receiver != null) {
-                       here = new AltosLatLon(receiver.getLatitude(), receiver.getLongitude());
+                       AltosLatLon new_here = new AltosLatLon(receiver.getLatitude(), receiver.getLongitude());
+                       if (!new_here.equals(here)) {
+                               here = new_here;
+                               AltosDebug.debug("Location changed, redraw");
+                               repaint();
+                       }
                }
        }