Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-11-25 09:50:13 +01:00
commit b6b0933cec
7 changed files with 16 additions and 12 deletions

View file

@ -68,7 +68,6 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.PowerManager; import android.os.PowerManager;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -755,7 +754,11 @@ public class MapActivity extends AccessibleActivity implements
return mapView; return mapView;
} }
public static MapViewTrackingUtilities getMapViewTrackingUtilities() { public MapViewTrackingUtilities getMapViewTrackingUtilities() {
return mapViewTrackingUtilities;
}
public static MapViewTrackingUtilities getSingleMapViewTrackingUtilities() {
return mapViewTrackingUtilities; return mapViewTrackingUtilities;
} }

View file

@ -129,7 +129,7 @@ public class MapActivityLayers {
mapView.addLayer(transportInfoLayer, 5.5f); mapView.addLayer(transportInfoLayer, 5.5f);
// 5.95 all text labels // 5.95 all text labels
// 6. point location layer // 6. point location layer
locationLayer = new PointLocationLayer(MapActivity.getMapViewTrackingUtilities()); locationLayer = new PointLocationLayer(activity.getMapViewTrackingUtilities());
mapView.addLayer(locationLayer, 6); mapView.addLayer(locationLayer, 6);
// 7. point navigation layer // 7. point navigation layer
navigationLayer = new PointNavigationLayer(activity); navigationLayer = new PointNavigationLayer(activity);
@ -197,7 +197,7 @@ public class MapActivityLayers {
// mapView.addLayer(transportInfoLayer, 5.5f); // mapView.addLayer(transportInfoLayer, 5.5f);
// 5.95 all text labels // 5.95 all text labels
// 6. point location layer // 6. point location layer
locationLayer = new PointLocationLayer(MapActivity.getMapViewTrackingUtilities()); locationLayer = new PointLocationLayer(activity.getMapViewTrackingUtilities());
// mapView.addLayer(locationLayer, 6); // mapView.addLayer(locationLayer, 6);
// 7. point navigation layer // 7. point navigation layer
navigationLayer = new PointNavigationLayer(activity); navigationLayer = new PointNavigationLayer(activity);

View file

@ -33,6 +33,7 @@ public class OsMoControlDevice implements OsMoReactor {
this.plugin = plugin; this.plugin = plugin;
this.service = service; this.service = service;
this.tracker = tracker; this.tracker = tracker;
service.registerReactor(this);
} }
public JSONObject getBatteryLevel() throws JSONException { public JSONObject getBatteryLevel() throws JSONException {

View file

@ -514,7 +514,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
} else if(item.getItemId() == SHOW_ON_MAP_ID) { } else if(item.getItemId() == SHOW_ON_MAP_ID) {
if(device != null) { if(device != null) {
Location location = device.getLastLocation(); Location location = device.getLastLocation();
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false); MapActivity.getSingleMapViewTrackingUtilities().setMapLinkedToLocation(false);
if (location != null){ if (location != null){
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(), app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
null, device.getVisibleName(), device); null, device.getVisibleName(), device);
@ -1296,7 +1296,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
@Override @Override
public void updateLocation(Location location) { public void updateLocation(Location location) {
MapViewTrackingUtilities mv = MapActivity.getMapViewTrackingUtilities(); MapViewTrackingUtilities mv = MapActivity.getSingleMapViewTrackingUtilities();
if(mv != null && mv.isMapLinkedToLocation() && location != null) { if(mv != null && mv.isMapLinkedToLocation() && location != null) {
Location lt = mapLocation; Location lt = mapLocation;
mapLocation = location; mapLocation = location;

View file

@ -143,7 +143,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude(); double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude(); double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
mapActivity.getMapView().setLatLon(lat, lon); mapActivity.getMapView().setLatLon(lat, lon);
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false); MapActivity.getSingleMapViewTrackingUtilities().setMapLinkedToLocation(false);
OsMoPositionLayer.setFollowTrackerId(o); OsMoPositionLayer.setFollowTrackerId(o);
return true; return true;
} }

View file

@ -84,17 +84,17 @@ public class MapNavigateControl extends MapControls {
RoutingHelper routingHelper = app.getRoutingHelper(); RoutingHelper routingHelper = app.getRoutingHelper();
if(routingHelper.isFollowingMode()) { if(routingHelper.isFollowingMode()) {
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);
MapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
} else { } else {
OsmandApplication ctx = mapActivity.getMyApplication(); OsmandApplication ctx = mapActivity.getMyApplication();
if(!ctx.getTargetPointsHelper().checkPointToNavigateShort()) { if(!ctx.getTargetPointsHelper().checkPointToNavigateShort()) {
ri.showDialog(); ri.showDialog();
} else { } else {
MapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
app.getSettings().FOLLOW_THE_ROUTE.set(true); app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true); routingHelper.setFollowingMode(true);
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);
MapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false); routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
app.getRoutingHelper().notifyIfRouteIsCalculated(); app.getRoutingHelper().notifyIfRouteIsCalculated();
} }

View file

@ -162,7 +162,7 @@ public class MapInfoWidgetsFactory {
public boolean updateInfo(DrawSettings drawSettings) { public boolean updateInfo(DrawSettings drawSettings) {
boolean nightMode = drawSettings == null ? false : drawSettings.isNightMode(); boolean nightMode = drawSettings == null ? false : drawSettings.isNightMode();
boolean enabled = map.getMyApplication().getLocationProvider().getLastKnownLocation() != null; boolean enabled = map.getMyApplication().getLocationProvider().getLastKnownLocation() != null;
boolean tracked = MapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation(); boolean tracked = map.getMapViewTrackingUtilities().isMapLinkedToLocation();
Drawable d; Drawable d;
if(!enabled) { if(!enabled) {
d = nightMode ? backToLocDisabledWhite : backToLocDisabled; d = nightMode ? backToLocDisabledWhite : backToLocDisabled;
@ -183,7 +183,7 @@ public class MapInfoWidgetsFactory {
backToLocation.setOnClickListener(new View.OnClickListener() { backToLocation.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
MapActivity.getMapViewTrackingUtilities().backToLocationImpl(); map.getMapViewTrackingUtilities().backToLocationImpl();
} }
}); });
return backToLocation; return backToLocation;