altosdroid: Class of offline map view widget changed
authorKeith Packard <keithp@keithp.com>
Thu, 25 Jun 2015 19:22:04 +0000 (12:22 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 25 Jun 2015 19:22:04 +0000 (12:22 -0700)
Switch around AltosViewPager to match.

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

index 339b78946c945b8e72559bedf8e6140870688b9b..5240d61ce75476ce4942889f1dcf3aed35d064b4 100644 (file)
@@ -424,7 +424,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
        double  mapAccuracy;
 
        public void center(double lat, double lon, double accuracy) {
        double  mapAccuracy;
 
        public void center(double lat, double lon, double accuracy) {
-               if (mapAccuracy < 0 || accuracy < mapAccuracy/10) {
+               if (mapAccuracy <= 0 || accuracy < mapAccuracy/10 || (map != null && !map.has_centre())) {
                        if (map != null)
                                map.maybe_centre(lat, lon);
                        mapAccuracy = accuracy;
                        if (map != null)
                                map.maybe_centre(lat, lon);
                        mapAccuracy = accuracy;
index b81cd394deb20a67cebb3c8446b84c54a46097a1..7691a13ea56723e89bd168f9fad6bac866c177d2 100644 (file)
@@ -275,7 +275,7 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke
                        center (my_position.lat, my_position.lon, accuracy);
                }
 
                        center (my_position.lat, my_position.lon, accuracy);
                }
 
-               if (my_position != null && target_position != null) {
+               if (my_position != null && target_position != null && mPolyline != null) {
                        mPolyline.setPoints(Arrays.asList(new LatLng(my_position.lat, my_position.lon), new LatLng(target_position.lat, target_position.lon)));
                        mPolyline.setVisible(true);
                }
                        mPolyline.setPoints(Arrays.asList(new LatLng(my_position.lat, my_position.lon), new LatLng(target_position.lat, target_position.lon)));
                        mPolyline.setVisible(true);
                }
index e8299b09aeda4f2de7f6f0d334b7cbda14c545b4..f22298d73d0a49a82c0c8a66c474cd82180a9041 100644 (file)
@@ -34,17 +34,19 @@ public class AltosViewPager extends ViewPager {
 
     @Override
     protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
 
     @Override
     protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
-       if (v.getClass().getName().endsWith("MapView"))
-           return true;
-
-       if(v.getClass() != null &&
-          v.getClass().getPackage() != null &&
-          v.getClass().getPackage().getName() != null &&
-          v.getClass().getPackage().getName().startsWith("maps."))
-       {
-            return true;
-        }
-        return super.canScroll(v, checkV, dx, x, y);
+
+           if (v.getClass() != null &&
+               v.getClass().getName() != null &&
+               v.getClass().getName().endsWith("MapOffline"))
+                   return true;
+
+           if(v.getClass() != null &&
+              v.getClass().getPackage() != null &&
+              v.getClass().getPackage().getName() != null &&
+              v.getClass().getPackage().getName().startsWith("maps."))
+                   return true;
+
+           return super.canScroll(v, checkV, dx, x, y);
     }
 
 }
     }
 
 }
index 2d0ae65de8ab5fcecdc857e50feabf988ac00de9..58bf8804513dbf787b0f3514fa3746099b7fa880 100644 (file)
@@ -441,6 +441,12 @@ public class TelemetryService extends Service implements LocationListener {
 
        @Override
        public void onCreate() {
 
        @Override
        public void onCreate() {
+
+               AltosDebug.init(this);
+
+               // Initialise preferences
+               AltosDroidPreferences.init(this);
+
                // Get local Bluetooth adapter
                bluetooth_adapter = BluetoothAdapter.getDefaultAdapter();
 
                // Get local Bluetooth adapter
                bluetooth_adapter = BluetoothAdapter.getDefaultAdapter();