Small issues

This commit is contained in:
Victor Shcherb 2018-05-24 10:11:37 +02:00
parent ef15bf722f
commit f6859d5ed0
2 changed files with 16 additions and 27 deletions

View file

@ -137,7 +137,7 @@ public class UiUtilities {
} else {
useCenter = true;
fromLoc = app.getMapViewTrackingUtilities().getMapLocation();
h = app.getMapViewTrackingUtilities().getHeading();
h = app.getMapViewTrackingUtilities().getMapRotate();
if(h != null) {
h = -h;
}
@ -172,7 +172,7 @@ public class UiUtilities {
if (fromLoc == null || h == null || toLoc == null) {
dd.setAngle(0);
} else {
float orientation = (cache == null ? 0 : cache.screenOrientation) * 90;
float orientation = (cache == null ? 0 : -cache.screenOrientation) * 90;
dd.setAngle(mes[1] - h + 180 + orientation);
}
if (newImage) {

View file

@ -1,15 +1,8 @@
package net.osmand.plus.mapcontextmenu;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.LinearLayout;
import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;
import net.osmand.CallbackWithObject;
import net.osmand.Location;
@ -56,11 +49,16 @@ import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.LinearLayout;
public class MapContextMenu extends MenuTitleController implements StateChangedListener<ApplicationMode>,
MapMarkerChangedListener, TargetPointChangedListener {
@ -84,9 +82,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private boolean centerMarker;
private int mapZoom;
private LatLon myLocation;
private boolean inLocationUpdate = false;
private boolean cachedMyLocation;
private boolean appModeChanged;
private boolean appModeListenerAdded;
private boolean autoHide;
@ -293,9 +289,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
boolean update, boolean restorePrevious) {
OsmandApplication app = mapActivity.getMyApplication();
if (myLocation == null) {
updateMyLocation(app.getLocationProvider().getLastKnownLocation(), false);
}
if (!update && isVisible()) {
if (this.object == null || !this.object.equals(object)) {
@ -422,7 +415,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
public void onFragmentResume() {
if (active && displayDistanceDirection() && myLocation != null) {
if (active && displayDistanceDirection()) {
updateLocation(false, true, false);
}
}
@ -1252,12 +1245,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private void updateMyLocation(Location location, boolean updateLocationUi) {
if (location == null) {
location = getMapActivity().getMyApplication().getLocationProvider().getLastStaleKnownLocation();
cachedMyLocation = location != null;
} else {
cachedMyLocation = false;
}
if (location != null) {
myLocation = new LatLon(location.getLatitude(), location.getLongitude());
if (updateLocationUi) {
updateLocation(false, true, false);
}