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;
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);
}
@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);
}
}