This commit is contained in:
Alex Sytnyk 2018-07-17 18:10:37 +03:00
parent 37e84689b1
commit 9ee89eb34b
3 changed files with 29 additions and 7 deletions

View file

@ -1336,6 +1336,8 @@ public class OsmandSettings {
MAP_MARKERS_MODE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, MapMarkersMode.TOOLBAR); MAP_MARKERS_MODE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, MapMarkersMode.TOOLBAR);
} }
public final OsmandPreference<Boolean> SHOW_MAP_MARKERS = new BooleanPreference("show_map_markers", true).makeGlobal();
public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumIntPreference<>("notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values()); public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumIntPreference<>("notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values());
public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache(); public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache();

View file

@ -186,6 +186,8 @@ public class ConfigureMapMenu {
} else { } else {
showGpxSelectionDialog(adapter, adapter.getItem(pos)); showGpxSelectionDialog(adapter, adapter.getItem(pos));
} }
} else if (itemId == R.string.map_markers) {
settings.SHOW_MAP_MARKERS.set(isChecked);
} else if (itemId == R.string.layer_map) { } else if (itemId == R.string.layer_map) {
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) { if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
Intent intent = new Intent(ma, PluginActivity.class); Intent intent = new Intent(ma, PluginActivity.class);
@ -464,6 +466,15 @@ public class ConfigureMapMenu {
.setIcon(R.drawable.ic_action_polygom_dark) .setIcon(R.drawable.ic_action_polygom_dark)
.setSecondaryIcon(R.drawable.ic_action_additional_option) .setSecondaryIcon(R.drawable.ic_action_additional_option)
.setListener(l).createItem()); .setListener(l).createItem());
selected = settings.SHOW_MAP_MARKERS.get();
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.map_markers, activity)
.setSelected(selected)
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setIcon(R.drawable.ic_action_flag_dark)
.setListener(l).createItem());
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.layer_map, activity) .setTitleId(R.string.layer_map, activity)
.setIcon(R.drawable.ic_world_globe_dark) .setIcon(R.drawable.ic_world_globe_dark)

View file

@ -233,6 +233,11 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
OsmandSettings settings = map.getMyApplication().getSettings();
if (!settings.SHOW_MAP_MARKERS.get()) {
return;
}
Location myLoc; Location myLoc;
if (useFingerLocation && fingerLocation != null) { if (useFingerLocation && fingerLocation != null) {
myLoc = new Location(""); myLoc = new Location("");
@ -243,7 +248,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
} }
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers(); List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
int displayedWidgets = map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get(); int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
if (route != null && route.points.size() > 0) { if (route != null && route.points.size() > 0) {
planRouteAttrs.updatePaints(view, nightMode, tileBox); planRouteAttrs.updatePaints(view, nightMode, tileBox);
@ -252,7 +257,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
route.drawRenderers(view.getZoom(), defaultAppMode ? planRouteAttrs.paint : planRouteAttrs.paint2, canvas, tileBox); route.drawRenderers(view.getZoom(), defaultAppMode ? planRouteAttrs.paint : planRouteAttrs.paint2, canvas, tileBox);
} }
if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { if (settings.SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {
textAttrs.paint.setTextSize(textSize); textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize); textAttrs.paint2.setTextSize(textSize);
@ -262,7 +267,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
textPaint.set(textAttrs.paint); textPaint.set(textAttrs.paint);
boolean drawMarkerName = map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 1; boolean drawMarkerName = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 1;
int locX; int locX;
int locY; int locY;
@ -325,7 +330,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
widgetsFactory.updateInfo(useFingerLocation ? fingerLocation : null, tileBox.getZoom()); widgetsFactory.updateInfo(useFingerLocation ? fingerLocation : null, tileBox.getZoom());
OsmandSettings settings = map.getMyApplication().getSettings(); OsmandSettings settings = map.getMyApplication().getSettings();
if (tileBox.getZoom() < 3) { if (tileBox.getZoom() < 3 || !settings.SHOW_MAP_MARKERS.get()) {
return; return;
} }
@ -499,8 +504,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public boolean runExclusiveAction(Object o, boolean unknownLocation) { public boolean runExclusiveAction(Object o, boolean unknownLocation) {
if (unknownLocation || o == null || !(o instanceof MapMarker) OsmandSettings settings = map.getMyApplication().getSettings();
|| !map.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { if (unknownLocation
|| o == null
|| !(o instanceof MapMarker)
|| !settings.SELECT_MARKER_ON_SINGLE_TAP.get()
|| !settings.SHOW_MAP_MARKERS.get()) {
return false; return false;
} }
final MapMarkersHelper helper = map.getMyApplication().getMapMarkersHelper(); final MapMarkersHelper helper = map.getMyApplication().getMapMarkersHelper();
@ -520,7 +529,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) { public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
if (tileBox.getZoom() < 3) { if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().SHOW_MAP_MARKERS.get()) {
return; return;
} }
amenities.clear(); amenities.clear();