Map markers UI fixes
This commit is contained in:
parent
7eacd0da63
commit
5cabbc46b5
3 changed files with 25 additions and 9 deletions
|
@ -197,12 +197,12 @@ public class MapMarkersHelper {
|
||||||
}
|
}
|
||||||
int colorIndex;
|
int colorIndex;
|
||||||
if (mapMarkers.size() > 0) {
|
if (mapMarkers.size() > 0) {
|
||||||
colorIndex = (mapMarkers.get(mapMarkers.size() - 1).colorIndex + 1) % MAP_MARKERS_COLORS_COUNT;
|
colorIndex = (mapMarkers.get(0).colorIndex + 1) % MAP_MARKERS_COLORS_COUNT;
|
||||||
} else {
|
} else {
|
||||||
colorIndex = 0;
|
colorIndex = 0;
|
||||||
}
|
}
|
||||||
settings.insertMapMarker(point.getLatitude(), point.getLongitude(),
|
settings.insertMapMarker(point.getLatitude(), point.getLongitude(),
|
||||||
pointDescription, colorIndex, mapMarkers.size());
|
pointDescription, colorIndex, 0);
|
||||||
|
|
||||||
readFromSettings();
|
readFromSettings();
|
||||||
refresh();
|
refresh();
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
markerBitmapOrange = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_orange);
|
markerBitmapOrange = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_orange);
|
||||||
markerBitmapRed = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_red);
|
markerBitmapRed = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_red);
|
||||||
markerBitmapYellow = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_yellow);
|
markerBitmapYellow = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_yellow);
|
||||||
markerBitmapTeal = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_red);
|
markerBitmapTeal = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_teal);
|
||||||
markerBitmapPurple = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_green);
|
markerBitmapPurple = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_marker_purple);
|
||||||
|
|
||||||
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination);
|
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination);
|
||||||
bitmapPaintDestBlue = createPaintDest(R.color.marker_blue);
|
bitmapPaintDestBlue = createPaintDest(R.color.marker_blue);
|
||||||
|
@ -182,9 +182,18 @@ public class MapMarkersLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
if (marker == null || tb == null) {
|
if (marker == null || tb == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return tb.containsLatLon(marker.getLatitude(), marker.getLongitude());
|
return containsLatLon(tb, marker.getLatitude(), marker.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsLatLon(RotatedTileBox tb, double lat, double lon) {
|
||||||
|
double widgetHeight = 0;
|
||||||
|
if (widget.isTopBarVisible()) {
|
||||||
|
widgetHeight = widget.getTopBarHeight();
|
||||||
|
}
|
||||||
|
double tx = tb.getPixXFromLatLon(lat, lon);
|
||||||
|
double ty = tb.getPixYFromLatLon(lat, lon);
|
||||||
|
return tx >= 0 && tx <= tb.getPixWidth() && ty >= widgetHeight && ty <= tb.getPixHeight();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyLayer() {
|
public void destroyLayer() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class MapMarkersWidget {
|
public class MapMarkersWidget {
|
||||||
|
|
||||||
public static final int MIN_DIST_OK_VISIBLE = 50;
|
public static final int MIN_DIST_OK_VISIBLE = 40;
|
||||||
|
|
||||||
private final MapActivity map;
|
private final MapActivity map;
|
||||||
private MapMarkersHelper helper;
|
private MapMarkersHelper helper;
|
||||||
|
@ -153,9 +153,18 @@ public class MapMarkersWidget {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTopBarHeight() {
|
||||||
|
return topBar.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTopBarVisible() {
|
||||||
|
return topBar.getVisibility() == View.VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateInfo(int zoom) {
|
public void updateInfo(int zoom) {
|
||||||
List<MapMarker> markers = helper.getActiveMapMarkers();
|
List<MapMarker> markers = helper.getActiveMapMarkers();
|
||||||
if (zoom < 3 || markers.size() == 0 || map.getMyApplication().getRoutingHelper().isFollowingMode()
|
if (zoom < 3 || markers.size() == 0 || map.getMyApplication().getRoutingHelper().isFollowingMode()
|
||||||
|
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
||||||
|| map.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().isVisible()) {
|
|| map.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().isVisible()) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
return;
|
return;
|
||||||
|
@ -194,9 +203,7 @@ public class MapMarkersWidget {
|
||||||
dd = (DirectionDrawable) arrowImg.getDrawable();
|
dd = (DirectionDrawable) arrowImg.getDrawable();
|
||||||
}
|
}
|
||||||
dd.setImage(R.drawable.map_arrow_to_destination, MapMarkerDialogHelper.getMapMarkerColorId(marker.colorIndex));
|
dd.setImage(R.drawable.map_arrow_to_destination, MapMarkerDialogHelper.getMapMarkerColorId(marker.colorIndex));
|
||||||
if (loc == null || heading == null || marker.point == null) {
|
if (heading != null && loc != null) {
|
||||||
dd.setAngle(0);
|
|
||||||
} else {
|
|
||||||
dd.setAngle(mes[1] - heading + 90 + screenOrientation);
|
dd.setAngle(mes[1] - heading + 90 + screenOrientation);
|
||||||
}
|
}
|
||||||
if (newImage) {
|
if (newImage) {
|
||||||
|
|
Loading…
Reference in a new issue