Fix center location

This commit is contained in:
Victor Shcherb 2015-06-11 10:10:37 +02:00
parent 23c8da8308
commit e7be02565f
3 changed files with 6 additions and 6 deletions

View file

@ -568,7 +568,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
new PointDescription(PointDescription.POINT_TYPE_MARKER, device.getVisibleName()), false,
device);
}
OsMoPositionLayer.setFollowTrackerId(device);
OsMoPositionLayer.setFollowTrackerId(device, location);
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
}
} else if (item.getItemId() == ON_OFF_ACTION_ID) {

View file

@ -131,11 +131,12 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
OsMoDevice o = (OsMoDevice) selectedObj;
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
Location loc = o.getLastLocation();
double lat = loc == null ? latitude : loc.getLatitude();
double lon = loc == null ? longitude : loc.getLongitude();
mapActivity.getMapView().setLatLon(lat, lon);
MapActivity.getSingleMapViewTrackingUtilities().setMapLinkedToLocation(false);
OsMoPositionLayer.setFollowTrackerId(o);
OsMoPositionLayer.setFollowTrackerId(o, loc);
return true;
}
}).position(0).reg();

View file

@ -297,10 +297,9 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
private static String followDestinationId;
private static LatLon followTargetLocation;
public static void setFollowTrackerId(OsMoDevice d) {
public static void setFollowTrackerId(OsMoDevice d, Location l) {
if(d != null) {
followTrackerId = d.trackerId;
Location l = d.getLastLocation();
if(l != null) {
followMapLocation = new LatLon(l.getLatitude(), l.getLongitude());
}