add new option "Distance by tap" in "Configure screen"

This commit is contained in:
Skalii 2021-02-19 15:53:09 +02:00
parent 1a230ab3d3
commit ec639cc4d3
3 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,7 @@
--> -->
<string name="map_widget_distance_by_tap">Distance by tap</string>
<string name="routing_attr_height_obstacles_description">Routing could avoid strong uphills.</string> <string name="routing_attr_height_obstacles_description">Routing could avoid strong uphills.</string>
<string name="app_restart_required">Application restart required to apply some settings.</string> <string name="app_restart_required">Application restart required to apply some settings.</string>
<string name="on_pause">On pause</string> <string name="on_pause">On pause</string>

View file

@ -1678,6 +1678,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SHOW_MAP_MARKERS = new BooleanPreference(this, "show_map_markers", true).makeProfile(); public final OsmandPreference<Boolean> SHOW_MAP_MARKERS = new BooleanPreference(this, "show_map_markers", true).makeProfile();
public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference(this, "show_coordinates_widget", false).makeProfile().cache(); public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference(this, "show_coordinates_widget", false).makeProfile().cache();
public final OsmandPreference<Boolean> SHOW_RULER_WIDGET = new BooleanPreference(this, "show_ruler_widget", false).makeProfile().cache();
public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumStringPreference<>(this, "notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values()); public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumStringPreference<>(this, "notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values());
public final CommonPreference<TracksSortByMode> TRACKS_SORT_BY_MODE = new EnumStringPreference<>(this, "tracks_sort_by_mode", TracksSortByMode.BY_DATE, TracksSortByMode.values()); public final CommonPreference<TracksSortByMode> TRACKS_SORT_BY_MODE = new EnumStringPreference<>(this, "tracks_sort_by_mode", TracksSortByMode.BY_DATE, TracksSortByMode.values());

View file

@ -368,7 +368,14 @@ public class MapWidgetRegistry {
.setIcon(R.drawable.ic_action_coordinates_widget) .setIcon(R.drawable.ic_action_coordinates_widget)
.setSelected(settings.SHOW_COORDINATES_WIDGET.get()) .setSelected(settings.SHOW_COORDINATES_WIDGET.get())
.setListener(new AppearanceItemClickListener(settings.SHOW_COORDINATES_WIDGET, map)) .setListener(new AppearanceItemClickListener(settings.SHOW_COORDINATES_WIDGET, map))
.setLayout(R.layout.list_item_icon_and_switch).createItem());
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_widget_distance_by_tap, map)
.setIcon(R.drawable.ic_action_ruler_line)
.setSelected(settings.SHOW_RULER_WIDGET.get())
.setListener(new AppearanceItemClickListener(settings.SHOW_RULER_WIDGET, map))
.setLayout(R.layout.list_item_icon_and_switch).createItem()); .setLayout(R.layout.list_item_icon_and_switch).createItem());
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, map) cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, map)
.setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map)) .setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map))
.setListener(new ContextMenuAdapter.ItemClickListener() { .setListener(new ContextMenuAdapter.ItemClickListener() {
@ -462,7 +469,7 @@ public class MapWidgetRegistry {
.setIcon(R.drawable.ic_quick_action) .setIcon(R.drawable.ic_quick_action)
.setSelected(selected) .setSelected(selected)
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) .setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setSecondaryIcon( R.drawable.ic_action_additional_option) .setSecondaryIcon(R.drawable.ic_action_additional_option)
.setListener(new ContextMenuAdapter.OnRowItemClick() { .setListener(new ContextMenuAdapter.OnRowItemClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) { public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {