diff --git a/OsmAnd/res/layout/map_marker_selection_fragment.xml b/OsmAnd/res/layout/map_marker_selection_fragment.xml new file mode 100644 index 0000000000..8215bdb8b5 --- /dev/null +++ b/OsmAnd/res/layout/map_marker_selection_fragment.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 9fe8064bea..d38fc5f8c3 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Select Map marker + Other markers Not enough space! This would need {3} MB temporarily and {1} MB permanently. Currently, there are only {2} MB available. diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 1357a564a4..62eca11c84 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1137,7 +1137,7 @@ public class OsmandSettings { public final OsmandPreference SHOULD_SHOW_FREE_VERSION_BANNER = new BooleanPreference("should_show_free_version_banner", false).makeGlobal().cache(); - public final OsmandPreference USE_MAP_MARKERS = new BooleanPreference("use_map_markers", false).makeGlobal().cache(); + public final OsmandPreference USE_MAP_MARKERS = new BooleanPreference("use_map_markers", true).makeGlobal().cache(); public final OsmandPreference SHOW_MAP_MARKERS_TOOLBAR = new BooleanPreference("show_map_markers_toolbar", true).makeGlobal().cache(); public ITileSource getMapTileSource(boolean warnWhenSelected) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java index bdae42cc9a..51de11033a 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java @@ -1,5 +1,6 @@ package net.osmand.plus.helpers; +import android.content.Context; import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; @@ -328,7 +329,7 @@ public class MapMarkerDialogHelper { if (v == null || v.findViewById(R.id.info_close) == null) { v = mapActivity.getLayoutInflater().inflate(R.layout.map_marker_item, null); } - updateMapMarkerInfoView(v, marker); + updateMapMarkerInfoView(mapActivity, v, loc, heading, useCenter, nightMode, screenOrientation, marker); final View more = v.findViewById(R.id.all_points); final View move = v.findViewById(R.id.info_move); final View remove = v.findViewById(R.id.info_close); @@ -368,7 +369,9 @@ public class MapMarkerDialogHelper { return v; } - protected void updateMapMarkerInfoView(View localView, final MapMarker marker) { + public static void updateMapMarkerInfoView(Context ctx, View localView, LatLon loc, + Float heading, boolean useCenter, boolean nightMode, + int screenOrientation, final MapMarker marker) { TextView text = (TextView) localView.findViewById(R.id.waypoint_text); TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow); TextView textDist = (TextView) localView.findViewById(R.id.waypoint_dist); @@ -389,7 +392,7 @@ public class MapMarkerDialogHelper { DirectionDrawable dd; if (!(arrow.getDrawable() instanceof DirectionDrawable)) { newImage = true; - dd = new DirectionDrawable(mapActivity, arrow.getWidth(), arrow.getHeight()); + dd = new DirectionDrawable(ctx, arrow.getWidth(), arrow.getHeight()); } else { dd = (DirectionDrawable) arrow.getDrawable(); } @@ -409,16 +412,18 @@ public class MapMarkerDialogHelper { arrow.setVisibility(View.VISIBLE); arrow.invalidate(); + OsmandApplication app = (OsmandApplication) ctx.getApplicationContext(); + if (!marker.history) { waypointIcon.setImageDrawable(getMapMarkerIcon(app, marker.colorIndex)); - AndroidUtils.setTextPrimaryColor(mapActivity, text, nightMode); - textDist.setTextColor(mapActivity.getResources() + AndroidUtils.setTextPrimaryColor(ctx, text, nightMode); + textDist.setTextColor(ctx.getResources() .getColor(useCenter ? R.color.color_distance : R.color.color_myloc_distance)); } else { waypointIcon.setImageDrawable(app.getIconsCache() .getContentIcon(R.drawable.ic_action_flag_dark, !nightMode)); - AndroidUtils.setTextSecondaryColor(mapActivity, text, nightMode); - AndroidUtils.setTextSecondaryColor(mapActivity, textDist, nightMode); + AndroidUtils.setTextSecondaryColor(ctx, text, nightMode); + AndroidUtils.setTextSecondaryColor(ctx, textDist, nightMode); } int dist = (int) mes[0]; @@ -654,7 +659,7 @@ public class MapMarkerDialogHelper { Object obj = listView.getItemAtPosition(i); View v = listView.getChildAt(i - listView.getFirstVisiblePosition()); if (obj == marker) { - updateMapMarkerInfoView(v, (MapMarker) obj); + updateMapMarkerInfoView(mapActivity, v, loc, heading, useCenter, nightMode, screenOrientation, marker); } } } catch (Exception e) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java index 8049e5a6cb..b3fbc3d203 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java @@ -28,6 +28,8 @@ import net.osmand.plus.ApplicationMode; import net.osmand.plus.GeocodingLookupService; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.IconsCache; +import net.osmand.plus.MapMarkersHelper; +import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; @@ -41,7 +43,9 @@ import net.osmand.plus.activities.actions.AppModeDialog; import net.osmand.plus.activities.search.SearchAddressActivity; import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.helpers.MapMarkerDialogHelper; import net.osmand.plus.mapcontextmenu.MapContextMenu; +import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment; import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener; @@ -82,6 +86,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener { private static final long SPINNER_START_ID = 5; private static final long SPINNER_FINISH_ID = 6; private static final long SPINNER_HINT_ID = 100; + private static final long SPINNER_MAP_MARKER_1_ID = 301; + private static final long SPINNER_MAP_MARKER_2_ID = 302; + private static final long SPINNER_MAP_MARKER_3_ID = 303; + private static final long SPINNER_MAP_MARKER_MORE_ID = 350; public MapRouteInfoMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) { this.mapActivity = mapActivity; @@ -255,6 +263,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener { intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra(TARGET_SELECT, true); mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT); + } else if (id == SPINNER_MAP_MARKER_MORE_ID) { + selectMapMarker(parentView, -1, true); + } else if (id == SPINNER_MAP_MARKER_1_ID) { + selectMapMarker(parentView, 0, true); + } else if (id == SPINNER_MAP_MARKER_2_ID) { + selectMapMarker(parentView, 1, true); + } else if (id == SPINNER_MAP_MARKER_3_ID) { + selectMapMarker(parentView, 2, true); } } @@ -303,6 +319,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener { intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra(TARGET_SELECT, false); mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT); + } else if (id == SPINNER_MAP_MARKER_MORE_ID) { + selectMapMarker(parentView, -1, false); + } else if (id == SPINNER_MAP_MARKER_1_ID) { + selectMapMarker(parentView, 0, false); + } else if (id == SPINNER_MAP_MARKER_2_ID) { + selectMapMarker(parentView, 1, false); + } else if (id == SPINNER_MAP_MARKER_3_ID) { + selectMapMarker(parentView, 2, false); } } @@ -356,7 +380,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(mapActivity, mapActivity.getMyApplication() .getFavorites().getFavouritePoints(), false); Dialog[] dlgHolder = new Dialog[1]; - OnItemClickListener click = getOnClickListener(target, favouritesAdapter, dlgHolder); + OnItemClickListener click = getOnFavoriteClickListener(target, favouritesAdapter, dlgHolder); OnDismissListener dismissListener = new DialogInterface.OnDismissListener() { @Override @@ -372,6 +396,43 @@ public class MapRouteInfoMenu implements IRouteInformationListener { FavoriteDialogs.showFavoritesDialog(mapActivity, favouritesAdapter, click, dismissListener, dlgHolder, true); } + private void selectMapMarker(final View parentView, final int index, final boolean target) { + if (index != -1) { + MapMarker m = mapActivity.getMyApplication().getMapMarkersHelper().getActiveMapMarkers().get(index); + LatLon point = new LatLon(m.getLatitude(), m.getLongitude()); + if (target) { + getTargets().navigateToPoint(point, true, -1, m.getPointDescription(mapActivity)); + } else { + getTargets().setStartPoint(point, true, m.getPointDescription(mapActivity)); + } + updateFromIcon(); + + } else { + OnItemClickListener click = new OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + selectMapMarker(parentView, position, target); + } + }; + OnDismissListener dismissListener = new DialogInterface.OnDismissListener() { + + @Override + public void onDismiss(DialogInterface dialog) { + if (target) { + setupToSpinner(parentView); + } else { + setupFromSpinner(parentView); + } + } + }; + + MapMarkerSelectionFragment selectionFragment = new MapMarkerSelectionFragment(); + selectionFragment.setClickListener(click); + selectionFragment.setDismissListener(dismissListener); + selectionFragment.show(mapActivity.getSupportFragmentManager(), MapMarkerSelectionFragment.TAG); + } + } + private boolean isLight() { return !nightMode; } @@ -381,8 +442,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener { return iconsCache.getIcon(iconId, 0, 0f); } - private OnItemClickListener getOnClickListener(final boolean target, final FavouritesAdapter favouritesAdapter, - final Dialog[] dlg) { + private OnItemClickListener getOnFavoriteClickListener(final boolean target, final FavouritesAdapter favouritesAdapter, + final Dialog[] dlg) { return new AdapterView.OnItemClickListener() { @Override @@ -577,7 +638,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { } private Spinner setupFromSpinner(View view) { - ArrayList fromActions = new ArrayList<>(); + List fromActions = new ArrayList<>(); fromActions.add(new RouteSpinnerRow(SPINNER_MY_LOCATION_ID, R.drawable.ic_action_get_my_location, mapActivity.getString(R.string.shared_string_my_location))); fromActions.add(new RouteSpinnerRow(SPINNER_FAV_ID, R.drawable.ic_action_fav_dark, @@ -608,6 +669,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener { geocodingLookupService.lookupAddress(startPointRequest); } } + + addMarkersToSpinner(fromActions); + final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner)); RouteSpinnerArrayAdapter fromAdapter = new RouteSpinnerArrayAdapter(view.getContext()); fromAdapter.addAll(fromActions); @@ -626,7 +690,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { private Spinner setupToSpinner(View view) { final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner)); final TargetPointsHelper targets = getTargets(); - ArrayList toActions = new ArrayList<>(); + List toActions = new ArrayList<>(); TargetPoint finish = getTargets().getPointToNavigate(); if (finish != null) { @@ -661,12 +725,41 @@ public class MapRouteInfoMenu implements IRouteInformationListener { toActions.add(new RouteSpinnerRow(SPINNER_ADDRESS_ID, R.drawable.ic_action_home_dark, mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis))); + addMarkersToSpinner(toActions); + RouteSpinnerArrayAdapter toAdapter = new RouteSpinnerArrayAdapter(view.getContext()); toAdapter.addAll(toActions); toSpinner.setAdapter(toAdapter); return toSpinner; } + private void addMarkersToSpinner(List actions) { + MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper(); + List markers = markersHelper.getActiveMapMarkers(); + if (markers.size() > 0) { + MapMarker m = markers.get(0); + actions.add(new RouteSpinnerRow(SPINNER_MAP_MARKER_1_ID, + MapMarkerDialogHelper.getMapMarkerIcon(mapActivity.getMyApplication(), m.colorIndex), + m.getOnlyName())); + } + if (markers.size() > 1) { + MapMarker m = markers.get(1); + actions.add(new RouteSpinnerRow(SPINNER_MAP_MARKER_2_ID, + MapMarkerDialogHelper.getMapMarkerIcon(mapActivity.getMyApplication(), m.colorIndex), + m.getOnlyName())); + } + if (markers.size() > 2) { + MapMarker m = markers.get(2); + actions.add(new RouteSpinnerRow(SPINNER_MAP_MARKER_3_ID, + MapMarkerDialogHelper.getMapMarkerIcon(mapActivity.getMyApplication(), m.colorIndex), + m.getOnlyName())); + } + if (markers.size() > 3) { + actions.add(new RouteSpinnerRow(SPINNER_MAP_MARKER_MORE_ID, 0, + mapActivity.getString(R.string.map_markers_other))); + } + } + private TargetPointsHelper getTargets() { return mapActivity.getMyApplication().getTargetPointsHelper(); } @@ -737,13 +830,24 @@ public class MapRouteInfoMenu implements IRouteInformationListener { private class RouteSpinnerRow { long id; int iconId; + Drawable icon; String text; + public RouteSpinnerRow(long id) { + this.id = id; + } + public RouteSpinnerRow(long id, int iconId, String text) { this.id = id; this.iconId = iconId; this.text = text; } + + public RouteSpinnerRow(long id, Drawable icon, String text) { + this.id = id; + this.icon = icon; + this.text = text; + } } private class RouteSpinnerArrayAdapter extends ArrayAdapter { @@ -766,7 +870,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener { @Override public boolean isEnabled(int position) { - return getItemId(position) != SPINNER_HINT_ID; + long id = getItemId(position); + return id != SPINNER_HINT_ID; } @Override @@ -781,19 +886,31 @@ public class MapRouteInfoMenu implements IRouteInformationListener { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { + long id = getItemId(position); TextView label = (TextView) super.getDropDownView(position, convertView, parent); RouteSpinnerRow row = getItem(position); - long id = getItemId(position); label.setText(row.text); if (id != SPINNER_HINT_ID) { - Drawable icon = mapActivity.getMyApplication().getIconsCache().getContentIcon(row.iconId); + Drawable icon = null; + if (row.icon != null) { + icon = row.icon; + } else if (row.iconId > 0) { + icon = mapActivity.getMyApplication().getIconsCache().getContentIcon(row.iconId); + } label.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); label.setCompoundDrawablePadding(AndroidUtils.dpToPx(mapActivity, 16f)); } else { label.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); label.setCompoundDrawablePadding(0); + } + if (id == SPINNER_MAP_MARKER_MORE_ID) { + label.setTextColor(!mapActivity.getMyApplication().getSettings().isLightContent() ? + mapActivity.getResources().getColor(R.color.color_dialog_buttons_dark) : mapActivity.getResources().getColor(R.color.color_dialog_buttons_light)); + } else { + label.setTextColor(!mapActivity.getMyApplication().getSettings().isLightContent() ? + ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_dark) : ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_light)); } label.setPadding(AndroidUtils.dpToPx(mapActivity, 16f), 0, 0, 0); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java new file mode 100644 index 0000000000..892525b979 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java @@ -0,0 +1,159 @@ +package net.osmand.plus.mapmarkers; + +import android.content.Context; +import android.content.DialogInterface; +import android.content.DialogInterface.OnDismissListener; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.Shape; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.ArrayAdapter; +import android.widget.ImageButton; +import android.widget.ListView; + +import net.osmand.AndroidUtils; +import net.osmand.Location; +import net.osmand.data.LatLon; +import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.base.BaseOsmAndDialogFragment; +import net.osmand.plus.base.MapViewTrackingUtilities; +import net.osmand.plus.dashboard.DashLocationFragment; +import net.osmand.plus.helpers.MapMarkerDialogHelper; +import net.osmand.plus.views.controls.ListDividerShape; + +import java.util.List; + +public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment { + public static final String TAG = "MapMarkerSelectionFragment"; + + private LatLon loc; + private Float heading; + private boolean useCenter; + private boolean nightMode; + private int screenOrientation; + + private OnItemClickListener clickListener; + private OnDismissListener dismissListener; + + public void setClickListener(OnItemClickListener clickListener) { + this.clickListener = clickListener; + } + + public void setDismissListener(OnDismissListener dismissListener) { + this.dismissListener = dismissListener; + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + MapActivity mapActivity = getMapActivity(); + OsmandApplication app = getMyApplication(); + if (mapActivity != null) { + screenOrientation = DashLocationFragment.getScreenOrientation(mapActivity); + + MapViewTrackingUtilities trackingUtils = mapActivity.getMapViewTrackingUtilities(); + float head = trackingUtils.getHeading(); + float mapRotation = mapActivity.getMapRotate(); + LatLon mw = mapActivity.getMapLocation(); + Location l = trackingUtils.getMyLocation(); + boolean mapLinked = trackingUtils.isMapLinkedToLocation() && l != null; + LatLon myLoc = l == null ? null : new LatLon(l.getLatitude(), l.getLongitude()); + useCenter = !mapLinked; + loc = (useCenter ? mw : myLoc); + heading = useCenter ? -mapRotation : head; + } + nightMode = !app.getSettings().isLightContent(); + + View view = inflater.inflate(R.layout.map_marker_selection_fragment, container, false); + ImageButton closeButton = (ImageButton) view.findViewById(R.id.closeButton); + closeButton.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_mode_back)); + closeButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + ListView listView = (ListView) view.findViewById(android.R.id.list); + int color; + if (nightMode) { + color = mapActivity.getResources().getColor(R.color.dashboard_divider_dark); + } else { + color = mapActivity.getResources().getColor(R.color.dashboard_divider_light); + } + Shape dividerShape = new ListDividerShape(color, 0); + final ShapeDrawable divider = new ShapeDrawable(dividerShape); + int divHeight = AndroidUtils.dpToPx(getContext(), 1f); + divider.setIntrinsicHeight(divHeight); + listView.setDivider(divider); + + final ArrayAdapter adapter = new MapMarkersListAdapter(); + List markers = getMyApplication().getMapMarkersHelper().getActiveMapMarkers(); + if (markers.size() > 0) { + adapter.addAll(markers); + } + listView.setAdapter(adapter); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + if (clickListener != null) { + clickListener.onItemClick(parent, view, position, id); + } + dismiss(); + } + }); + return view; + } + + @Override + public void onDismiss(DialogInterface dialog) { + super.onDismiss(dialog); + if (dismissListener != null) { + dismissListener.onDismiss(dialog); + } + } + + private class MapMarkersListAdapter extends ArrayAdapter { + + public MapMarkersListAdapter() { + super(getMapActivity(), R.layout.map_marker_item); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + MapMarker marker = getItem(position); + if (convertView == null) { + convertView = getMapActivity().getLayoutInflater().inflate(R.layout.map_marker_item, null); + } + MapMarkerDialogHelper.updateMapMarkerInfoView(getContext(), convertView, loc, heading, + useCenter, nightMode, screenOrientation, marker); + final View remove = convertView.findViewById(R.id.info_close); + remove.setVisibility(View.GONE); + AndroidUtils.setListItemBackground(getMapActivity(), convertView, nightMode); + + return convertView; + } + } + + public MapActivity getMapActivity() { + Context ctx = getContext(); + if (ctx instanceof MapActivity) { + return (MapActivity) ctx; + } else { + return null; + } + } + + public OsmandApplication getMyApplication() { + return (OsmandApplication) getContext().getApplicationContext(); + } +} diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java index 52b4f9a00a..bce61a89fc 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java @@ -250,7 +250,7 @@ public class MapMarkersWidgetsFactory { if (loc != null) { txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication()); } else { - txt = "— " + map.getString(R.string.m); + txt = "—"; } distText.setText(txt); updateVisibility(okButton, !customLocation && loc != null && dist < MIN_DIST_OK_VISIBLE);