Replace "move to top bar" with "make active"; turn on distance indication after "make active" button click

This commit is contained in:
alex 2017-12-08 14:20:18 +02:00
parent 640a54cdbc
commit e760665a43
2 changed files with 10 additions and 3 deletions

View file

@ -60,7 +60,6 @@
<string name="rename_marker">Rename marker</string> <string name="rename_marker">Rename marker</string>
<string name="tap_on_map_to_hide_interface_descr">A tap on the map toggles the control buttons and widgets.</string> <string name="tap_on_map_to_hide_interface_descr">A tap on the map toggles the control buttons and widgets.</string>
<string name="tap_on_map_to_hide_interface">Full screen mode</string> <string name="tap_on_map_to_hide_interface">Full screen mode</string>
<string name="show_on_top_bar">Show on Top Bar</string>
<string name="mark_passed">Mark passed</string> <string name="mark_passed">Mark passed</string>
<string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string> <string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string>
<string name="import_as_gpx">Import as GPX file</string> <string name="import_as_gpx">Import as GPX file</string>

View file

@ -7,6 +7,8 @@ import net.osmand.data.PointDescription;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.MapMarkerDialogHelper; import net.osmand.plus.helpers.MapMarkerDialogHelper;
@ -20,10 +22,11 @@ public class MapMarkerMenuController extends MenuController {
public MapMarkerMenuController(MapActivity mapActivity, PointDescription pointDescription, MapMarker mapMarker) { public MapMarkerMenuController(MapActivity mapActivity, PointDescription pointDescription, MapMarker mapMarker) {
super(new MenuBuilder(mapActivity), pointDescription, mapActivity); super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
final OsmandApplication app = mapActivity.getMyApplication();
this.mapMarker = mapMarker; this.mapMarker = mapMarker;
builder.setShowNearestWiki(true); builder.setShowNearestWiki(true);
final MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper(); final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
leftTitleButtonController = new TitleButtonController() { leftTitleButtonController = new TitleButtonController() {
@Override @Override
public void buttonPressed() { public void buttonPressed() {
@ -38,11 +41,16 @@ public class MapMarkerMenuController extends MenuController {
leftSubtitleButtonController = new TitleButtonController() { leftSubtitleButtonController = new TitleButtonController() {
@Override @Override
public void buttonPressed() { public void buttonPressed() {
OsmandSettings.OsmandPreference<Boolean> indication = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED;
if (!indication.get()) {
indication.set(true);
getMapActivity().getMapLayers().getMapWidgetRegistry().updateMapMarkersMode(getMapActivity());
}
markersHelper.moveMarkerToTop(getMapMarker()); markersHelper.moveMarkerToTop(getMapMarker());
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
} }
}; };
leftSubtitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar); leftSubtitleButtonController.caption = getMapActivity().getString(R.string.make_active);
leftSubtitleButtonController.leftIcon = createShowOnTopbarIcon(); leftSubtitleButtonController.leftIcon = createShowOnTopbarIcon();
} }