Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-11 18:43:19 +02:00
commit 9dfdbd2078
16 changed files with 291 additions and 97 deletions

View file

@ -7,21 +7,14 @@
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <ImageView
android:id="@+id/top_divider" android:id="@+id/top_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_top"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible"/>
<View
android:layout_width="match_parent"
android:layout_height="4dp"/>
<include layout="@layout/card_top_divider"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/main_layout" android:id="@+id/main_layout"

View file

@ -109,9 +109,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small" android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small" android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textAppearance="@style/TextAppearance.ListItemTitle"
@ -134,8 +132,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"

View file

@ -3508,4 +3508,6 @@
<string name="poi_government_transportation">Транспортное учреждение</string> <string name="poi_government_transportation">Транспортное учреждение</string>
<string name="poi_government_legislative">Законодательное учреждение</string> <string name="poi_government_legislative">Законодательное учреждение</string>
<string name="poi_surface_clay">Глина</string>
</resources> </resources>

View file

@ -2490,7 +2490,7 @@
<string name="of">%1$d из %2$d</string> <string name="of">%1$d из %2$d</string>
<string name="shared_string_list">Список</string> <string name="shared_string_list">Список</string>
<string name="shared_string_groups">Группы</string> <string name="shared_string_groups">Группы</string>
<string name="passed">Последнее использование: %1$s</string> <string name="passed">Пройдено: %1$s</string>
<string name="make_active">Сделать активным</string> <string name="make_active">Сделать активным</string>
<string name="today">Сегодня</string> <string name="today">Сегодня</string>
<string name="yesterday">Вчера</string> <string name="yesterday">Вчера</string>

View file

@ -3485,4 +3485,14 @@
<string name="poi_vhf">VHF channel</string> <string name="poi_vhf">VHF channel</string>
<string name="poi_gorge">Gorge</string>
<string name="poi_couloir">Couloir</string>
<string name="poi_mountain_area">Mountain area</string>
<string name="poi_surface_clay">Clay</string>
<string name="poi_surface_tartan">Tartan</string>
<string name="poi_surface_artificial_turf">Artificial turf</string>
<string name="poi_surface_decoturf">DecoTurf</string>
<string name="poi_surface_metal_grid">Metal grid</string>
</resources> </resources>

View file

@ -1337,6 +1337,7 @@ public class OsmandSettings {
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();
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache(); public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache();
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_ROUND_TRIP = new BooleanPreference("route_map_markers_round_trip", false).makeGlobal().cache();
public ITileSource getMapTileSource(boolean warnWhenSelected) { public ITileSource getMapTileSource(boolean warnWhenSelected) {
String tileName = MAP_TILE_SOURCES.get(); String tileName = MAP_TILE_SOURCES.get();

View file

@ -1440,7 +1440,7 @@ public class GpxUiHelper {
calculatedH[k] = ph + (values.get(nextW).getY() - ph) / (values.get(nextW).getX() - pd) * (calculatedDist[k] - pd); calculatedH[k] = ph + (values.get(nextW).getY() - ph) / (values.get(nextW).getX() - pd) * (calculatedDist[k] - pd);
} }
double SLOPE_PROXIMITY = 150; double SLOPE_PROXIMITY = 100;
if (totalDistance - SLOPE_PROXIMITY < 0) { if (totalDistance - SLOPE_PROXIMITY < 0) {
if (useRightAxis) { if (useRightAxis) {

View file

@ -889,26 +889,31 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
} }
int dp16 = dpToPx(16f); int dp16 = dpToPx(16f);
boolean has16margin = false;
int titleButtonHeight = 0; int titleButtonHeight = 0;
View titleButtonContainer = view.findViewById(R.id.title_button_container); View titleButtonContainer = view.findViewById(R.id.title_button_container);
if (titleButtonContainer.getVisibility() == View.VISIBLE) { if (titleButtonContainer.getVisibility() == View.VISIBLE) {
titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16; titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16;
if (titleButtonHeight < 0) { if (titleButtonHeight < 0) {
titleButtonHeight = 0; titleButtonHeight = 0;
} else {
has16margin = true;
} }
} }
int downloadButtonsHeight = 0; int downloadButtonsHeight = 0;
View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container); View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container);
if (downloadButtonsContainer.getVisibility() == View.VISIBLE) { if (downloadButtonsContainer.getVisibility() == View.VISIBLE) {
downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - dp16; downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - (has16margin ? 0 : dp16);
if (downloadButtonsHeight < 0) { if (downloadButtonsHeight < 0) {
downloadButtonsHeight = 0; downloadButtonsHeight = 0;
} else {
has16margin = true;
} }
} }
int titleProgressHeight = 0; int titleProgressHeight = 0;
View titleProgressContainer = view.findViewById(R.id.title_progress_container); View titleProgressContainer = view.findViewById(R.id.title_progress_container);
if (titleProgressContainer.getVisibility() == View.VISIBLE) { if (titleProgressContainer.getVisibility() == View.VISIBLE) {
titleProgressHeight = titleProgressContainer.getMeasuredHeight() - dp16; titleProgressHeight = titleProgressContainer.getMeasuredHeight() - (has16margin ? 0 : dp16);
if (titleProgressHeight < 0) { if (titleProgressHeight < 0) {
titleProgressHeight = 0; titleProgressHeight = 0;
} }

View file

@ -11,6 +11,7 @@ import net.osmand.data.TransportStop;
import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter; import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType; import net.osmand.osm.PoiType;
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.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
@ -104,6 +105,12 @@ public class AmenityMenuController extends MenuController {
return true; return true;
} }
@Override
public String getNameStr() {
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
return amenity.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get());
}
@Override @Override
public String getTypeStr() { public String getTypeStr() {
return getTypeStr(amenity); return getTypeStr(amenity);

View file

@ -55,7 +55,7 @@ public class RenderedObjectMenuController extends MenuController {
@Override @Override
public String getNameStr() { public String getNameStr() {
if (!Algorithms.isEmpty(renderedObject.getName())) { if (!Algorithms.isEmpty(renderedObject.getName()) && !isStartingWithRTLChar(renderedObject.getName())) {
return renderedObject.getName(); return renderedObject.getName();
} else if (renderedObject.getTags().size() > 0) { } else if (renderedObject.getTags().size() > 0) {
String lang = getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get().toLowerCase(); String lang = getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get().toLowerCase();
@ -67,6 +67,8 @@ public class RenderedObjectMenuController extends MenuController {
name = renderedObject.getTags().get("name"); name = renderedObject.getTags().get("name");
} }
return name; return name;
} else if (!Algorithms.isEmpty(renderedObject.getName())) {
return renderedObject.getName();
} }
return ""; return "";
} }
@ -97,4 +99,13 @@ public class RenderedObjectMenuController extends MenuController {
} }
addMyLocationToPlainItems(latLon); addMyLocationToPlainItems(latLon);
} }
private boolean isStartingWithRTLChar(String s) {
byte directionality = Character.getDirectionality(s.charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
|| directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
|| directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
|| directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE;
}
} }

View file

@ -172,6 +172,10 @@ public class MarkersPlanRouteContext {
for (LatLon l : markersHelper.getSelectedMarkersLatLon()) { for (LatLon l : markersHelper.getSelectedMarkersLatLon()) {
addWptPt(points, l.getLatitude(), l.getLongitude()); addWptPt(points, l.getLatitude(), l.getLongitude());
} }
if (app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get() && !points.isEmpty()) {
WptPt l = points.get(0);
addWptPt(points, l.getLatitude(), l.getLongitude());
}
return points; return points;
} }

View file

@ -24,12 +24,12 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.TspAnt; import net.osmand.TspAnt;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.GPXUtilities.TrkSegment; import net.osmand.plus.GPXUtilities.TrkSegment;
@ -38,9 +38,12 @@ 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.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener; import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener;
@ -48,6 +51,7 @@ import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter; import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter;
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment;
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.MapMarkersLayer; import net.osmand.plus.views.MapMarkersLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
@ -59,9 +63,10 @@ import java.util.List;
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
public class PlanRouteFragment extends Fragment { public class PlanRouteFragment extends Fragment implements OsmAndLocationListener {
public static final String TAG = "PlanRouteFragment"; public static final String TAG = "PlanRouteFragment";
private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters
private MapMarkersHelper markersHelper; private MapMarkersHelper markersHelper;
private MarkersPlanRouteContext planRouteContext; private MarkersPlanRouteContext planRouteContext;
@ -78,6 +83,9 @@ public class PlanRouteFragment extends Fragment {
private boolean nightMode; private boolean nightMode;
private boolean portrait; private boolean portrait;
private boolean wasCollapseButtonVisible; private boolean wasCollapseButtonVisible;
private boolean cancelSnapToRoad = true;
private Location location;
private View mainView; private View mainView;
private RecyclerView markersRv; private RecyclerView markersRv;
@ -251,7 +259,6 @@ public class PlanRouteFragment extends Fragment {
adapter = new MapMarkersListAdapter(mapActivity); adapter = new MapMarkersListAdapter(mapActivity);
adapter.setHasStableIds(true); adapter.setHasStableIds(true);
adapter.calculateStartAndFinishPos();
adapter.setSnappedToRoadPoints(planRouteContext.getSnappedToRoadPoints()); adapter.setSnappedToRoadPoints(planRouteContext.getSnappedToRoadPoints());
final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(adapter)); final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(adapter));
touchHelper.attachToRecyclerView(markersRv); touchHelper.attachToRecyclerView(markersRv);
@ -266,10 +273,11 @@ public class PlanRouteFragment extends Fragment {
if (pos == RecyclerView.NO_POSITION) { if (pos == RecyclerView.NO_POSITION) {
return; return;
} }
if (pos == 0) { Object item = adapter.getItem(pos);
if (item instanceof Location) {
markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get()); markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get());
} else { } else if (item instanceof MapMarker) {
MapMarker marker = adapter.getItem(pos); MapMarker marker = (MapMarker) item;
selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1;
marker.selected = !marker.selected; marker.selected = !marker.selected;
markersHelper.updateMapMarker(marker, false); markersHelper.updateMapMarker(marker, false);
@ -305,7 +313,7 @@ public class PlanRouteFragment extends Fragment {
} }
}); });
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108)); markersRv.setPadding(0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 10 : 15), 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12));
markersRv.setClipToPadding(false); markersRv.setClipToPadding(false);
markersRv.setLayoutManager(new LinearLayoutManager(getContext())); markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
markersRv.setAdapter(adapter); markersRv.setAdapter(adapter);
@ -317,12 +325,59 @@ public class PlanRouteFragment extends Fragment {
return view; return view;
} }
@Override
public void onResume() {
super.onResume();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.getMyApplication().getLocationProvider().addLocationListener(this);
}
}
@Override
public void onPause() {
super.onPause();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.getMyApplication().getLocationProvider().removeLocationListener(this);
}
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
exitPlanRouteMode(); exitPlanRouteMode();
} }
@Override
public void updateLocation(Location loc) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
final Location location = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
boolean newLocation = (this.location == null && location != null) || location == null;
boolean locationChanged = this.location != null && location != null
&& this.location.getLatitude() != location.getLatitude()
&& this.location.getLongitude() != location.getLongitude();
boolean farEnough = locationChanged && MapUtils.getDistance(this.location.getLatitude(), this.location.getLongitude(),
location.getLatitude(), location.getLongitude()) >= MIN_DISTANCE_FOR_RECALCULATE;
if (newLocation || farEnough) {
mapActivity.getMyApplication().runInUIThread(new Runnable() {
@Override
public void run() {
PlanRouteFragment.this.location = location;
adapter.reloadData();
try {
adapter.notifyDataSetChanged();
} catch (Exception e) {
// to avoid crash because of:
// java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
}
}
});
}
}
}
private MapActivity getMapActivity() { private MapActivity getMapActivity() {
return (MapActivity) getActivity(); return (MapActivity) getActivity();
} }
@ -353,6 +408,10 @@ public class PlanRouteFragment extends Fragment {
@Override @Override
public void onApplicationModeItemClick(ApplicationMode mode) { public void onApplicationModeItemClick(ApplicationMode mode) {
if (planRouteContext.getSnappedMode() != mode) { if (planRouteContext.getSnappedMode() != mode) {
MapMarkersLayer layer = getMapMarkersLayer();
if (layer != null) {
layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT);
}
planRouteContext.getSnappedToRoadPoints().clear(); planRouteContext.getSnappedToRoadPoints().clear();
planRouteContext.setSnappedMode(mode); planRouteContext.setSnappedMode(mode);
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment();
@ -375,14 +434,58 @@ public class PlanRouteFragment extends Fragment {
@Override @Override
public void navigateOnClick() { public void navigateOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
Toast.makeText(mapActivity, "navigate", Toast.LENGTH_SHORT).show(); boolean hasTargets = false;
TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
List<MapMarker> markers = markersHelper.getSelectedMarkers();
if (markers.size() > 0) {
int i = 0;
if (markersHelper.isStartFromMyLocation()) {
targetPointsHelper.clearStartPoint(false);
} else {
MapMarker m = markers.get(i++);
targetPointsHelper.setStartPoint(new LatLon(m.getLatitude(), m.getLongitude()),
false, m.getPointDescription(mapActivity));
}
List<TargetPoint> targetPoints = new ArrayList<>();
for (int k = i; k < markers.size(); k++) {
MapMarker m = markers.get(k);
TargetPoint t = new TargetPoint(new LatLon(m.getLatitude(), m.getLongitude()),
m.getPointDescription(mapActivity));
targetPoints.add(t);
}
if (mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get()) {
TargetPoint end = targetPointsHelper.getPointToStart();
if (end == null) {
Location loc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
if (loc != null) {
end = TargetPoint.createStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()),
new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION,
getString(R.string.shared_string_my_location)));
}
}
if (end != null) {
targetPoints.add(end);
}
}
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
boolean updateRoute = routingHelper.isFollowingMode() || routingHelper.isRoutePlanningMode();
targetPointsHelper.reorderAllTargetPoints(targetPoints, updateRoute);
hasTargets = true;
} else {
targetPointsHelper.clearStartPoint(false);
targetPointsHelper.clearPointToNavigate(false);
}
dismiss();
mapActivity.getMapLayers().getMapControlsLayer().doRoute(hasTargets);
} }
} }
@Override @Override
public void makeRoundTripOnClick() { public void makeRoundTripOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
Toast.makeText(mapActivity, "make round trip", Toast.LENGTH_SHORT).show(); OsmandSettings settings = mapActivity.getMyApplication().getSettings();
settings.ROUTE_MAP_MARKERS_ROUND_TRIP.set(!settings.ROUTE_MAP_MARKERS_ROUND_TRIP.get());
planRouteContext.recreateSnapTrkSegment();
} }
} }
@ -402,7 +505,7 @@ public class PlanRouteFragment extends Fragment {
public void reverseOrderOnClick() { public void reverseOrderOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
markersHelper.reverseActiveMarkersOrder(); markersHelper.reverseActiveMarkersOrder();
adapter.calculateStartAndFinishPos(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment();
} }
@ -539,7 +642,9 @@ public class PlanRouteFragment extends Fragment {
mapActivity.getMapView().setMapPosition(previousMapPosition); mapActivity.getMapView().setMapPosition(previousMapPosition);
planRouteContext.cancelSnapToRoad(); if (cancelSnapToRoad) {
planRouteContext.cancelSnapToRoad();
}
markersLayer.setRoute(null); markersLayer.setRoute(null);
mapActivity.refreshMap(); mapActivity.refreshMap();
} }
@ -610,6 +715,7 @@ public class PlanRouteFragment extends Fragment {
private void showHideMarkersList() { private void showHideMarkersList() {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null && portrait) { if (mapActivity != null && portrait) {
cancelSnapToRoad = false;
planRouteContext.setMarkersListOpened(!planRouteContext.isMarkersListOpened()); planRouteContext.setMarkersListOpened(!planRouteContext.isMarkersListOpened());
int containerRes = planRouteContext.isMarkersListOpened() ? R.id.fragmentContainer : R.id.bottomFragmentContainer; int containerRes = planRouteContext.isMarkersListOpened() ? R.id.fragmentContainer : R.id.bottomFragmentContainer;
mapActivity.getSupportFragmentManager().beginTransaction() mapActivity.getSupportFragmentManager().beginTransaction()
@ -670,18 +776,21 @@ public class PlanRouteFragment extends Fragment {
} }
public boolean quit(boolean hideMarkersListFirst) { public boolean quit(boolean hideMarkersListFirst) {
if (planRouteContext.isMarkersListOpened() && hideMarkersListFirst) { if (portrait && planRouteContext.isMarkersListOpened() && hideMarkersListFirst) {
showHideMarkersList(); showHideMarkersList();
return false; return false;
} else { } else {
dismiss(getMapActivity()); dismiss();
return true; return true;
} }
} }
private void dismiss(MapActivity activity) { private void dismiss() {
planRouteContext.setFragmentVisible(false); MapActivity activity = getMapActivity();
activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); if (activity != null) {
planRouteContext.setFragmentVisible(false);
activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
}
} }
public static boolean showInstance(MapActivity mapActivity) { public static boolean showInstance(MapActivity mapActivity) {
@ -755,7 +864,7 @@ public class PlanRouteFragment extends Fragment {
} }
mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res); mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res);
adapter.calculateStartAndFinishPos(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(); planRouteContext.recreateSnapTrkSegment();
} }

View file

@ -13,6 +13,7 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -59,6 +60,8 @@ public class PlanRouteOptionsBottomSheetDialogFragment extends BottomSheetDialog
((ImageView) mainView.findViewById(R.id.door_to_door_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_door_to_door)); ((ImageView) mainView.findViewById(R.id.door_to_door_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_door_to_door));
((ImageView) mainView.findViewById(R.id.reverse_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_reverse_order)); ((ImageView) mainView.findViewById(R.id.reverse_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_reverse_order));
((CompoundButton) mainView.findViewById(R.id.make_round_trip_switch)).setChecked(getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get());
if (!portrait) { if (!portrait) {
((ImageView) mainView.findViewById(R.id.select_icon)) ((ImageView) mainView.findViewById(R.id.select_icon))
.setImageDrawable(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all)); .setImageDrawable(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all));

View file

@ -11,7 +11,10 @@ import android.view.ViewGroup;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
import net.osmand.plus.GeocodingLookupService.OnAddressLookupResult;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
@ -23,6 +26,7 @@ import net.osmand.util.MapUtils;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -33,13 +37,18 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
private static final int LOCATION_ITEM_ID = 0; private static final int LOCATION_ITEM_ID = 0;
private MapActivity mapActivity; private MapActivity mapActivity;
private List<MapMarker> markers; private List<Object> items = new LinkedList<>();
private MapMarkersListAdapterListener listener; private MapMarkersListAdapterListener listener;
private int startPos = -1; private int startPos = -1;
private int finishPos = -1; private int finishPos = -1;
private int firstSelectedMarkerPos = -1; private int firstSelectedMarkerPos = -1;
private boolean showLocationItem;
private Location myLoc;
private AddressLookupRequest locRequest;
private PointDescription locDescription;
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints; private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints;
public void setAdapterListener(MapMarkersListAdapterListener listener) { public void setAdapterListener(MapMarkersListAdapterListener listener) {
@ -51,8 +60,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
} }
public MapMarkersListAdapter(MapActivity mapActivity) { public MapMarkersListAdapter(MapActivity mapActivity) {
locDescription = new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION,
mapActivity.getString(R.string.shared_string_location));
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
markers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers(); reloadData();
} }
@Override @Override
@ -73,16 +84,16 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
boolean night = app.getDaynightHelper().isNightModeForMapControls(); boolean night = app.getDaynightHelper().isNightModeForMapControls();
IconsCache iconsCache = app.getIconsCache(); IconsCache iconsCache = app.getIconsCache();
boolean locationItem = pos == 0; boolean locationItem = showLocationItem && pos == 0;
boolean firstMarkerItem = showLocationItem ? pos == 1 : pos == 0;
boolean lastMarkerItem = pos == getItemCount() - 1; boolean lastMarkerItem = pos == getItemCount() - 1;
boolean start = pos == startPos; boolean start = pos == startPos;
boolean finish = pos == finishPos && startPos != finishPos; boolean finish = pos == finishPos && startPos != finishPos;
boolean firstSelectedMarker = pos == firstSelectedMarkerPos; boolean firstSelectedMarker = pos == firstSelectedMarkerPos;
Location myLoc = app.getLocationProvider().getLastStaleKnownLocation(); boolean useLocation = app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem;
boolean useLocation = app.getMapMarkersHelper().isStartFromMyLocation() && myLoc != null;
MapMarker marker = locationItem ? null : getItem(pos); MapMarker marker = locationItem ? null : (MapMarker) getItem(pos);
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light)); holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black)); holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
@ -99,10 +110,13 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
} }
}); });
holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE); holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE);
holder.iconReorder.setVisibility(View.VISIBLE);
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
holder.firstDescription.setVisibility((start || finish) ? View.VISIBLE : View.GONE); holder.firstDescription.setVisibility((start || finish) ? View.VISIBLE : View.GONE);
if (start) { if (start) {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + (locationItem && !useLocation ? "" : "")); holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + "");
} else if (finish) { } else if (finish) {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + ""); holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + "");
} }
@ -116,24 +130,20 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (locationItem) { if (locationItem) {
holder.topDivider.setVisibility(View.VISIBLE); holder.topDivider.setVisibility(View.VISIBLE);
holder.flagIconLeftSpace.setVisibility(View.VISIBLE);
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location)); holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
holder.point.setVisibility(View.GONE);
holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation()); holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation());
holder.iconReorder.setVisibility(View.GONE); holder.iconReorder.setAlpha(.5f);
holder.description.setVisibility(View.GONE); holder.iconReorder.setOnTouchListener(null);
holder.distance.setVisibility(View.GONE); holder.distance.setVisibility(View.GONE);
holder.description.setText(locDescription.getName());
} else { } else {
holder.topDivider.setVisibility(View.GONE); holder.topDivider.setVisibility((!showLocationItem && firstMarkerItem) ? View.VISIBLE : View.GONE);
holder.flagIconLeftSpace.setVisibility(View.GONE);
if (!iconSettled) { if (!iconSettled) {
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex))); holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
} }
holder.point.setVisibility(View.VISIBLE);
holder.checkBox.setChecked(marker.selected); holder.checkBox.setChecked(marker.selected);
holder.iconReorder.setVisibility(View.VISIBLE); holder.iconReorder.setAlpha(1f);
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() { holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View view, MotionEvent event) { public boolean onTouch(View view, MotionEvent event) {
@ -144,8 +154,6 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
} }
}); });
holder.description.setVisibility(View.VISIBLE);
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
String descr; String descr;
if ((descr = marker.groupName) != null) { if ((descr = marker.groupName) != null) {
if (descr.equals("")) { if (descr.equals("")) {
@ -164,14 +172,16 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
} }
boolean showDistance = locationItem ? useLocation : marker.selected; boolean showDistance = locationItem ? useLocation : marker.selected;
boolean showPoint = showDistance && !locationItem; int visibility = showDistance ? View.VISIBLE : View.GONE;
holder.distance.setVisibility(showDistance ? View.VISIBLE : View.GONE); holder.distance.setVisibility(visibility);
holder.point.setVisibility(showPoint ? View.VISIBLE : View.GONE); holder.point.setVisibility(visibility);
holder.leftPointSpace.setVisibility(visibility);
holder.rightPointSpace.setVisibility(visibility);
if (showDistance) { if (showDistance) {
holder.distance.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_distance : R.color.color_myloc_distance)); holder.distance.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_distance : R.color.color_myloc_distance));
LatLon first = firstSelectedMarker && useLocation LatLon first = firstSelectedMarker && useLocation
? new LatLon(myLoc.getLatitude(), myLoc.getLongitude()) ? new LatLon(myLoc.getLatitude(), myLoc.getLongitude())
: getPreviousSelectedMarkerLatLon(pos - 1); : getPreviousSelectedMarkerLatLon(pos);
float dist = 0; float dist = 0;
if (first != null && marker != null) { if (first != null && marker != null) {
WptPt pt1 = new WptPt(); WptPt pt1 = new WptPt();
@ -196,16 +206,16 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return position == 0 ? LOCATION_ITEM_ID : getItem(position).hashCode(); return position == 0 && showLocationItem ? LOCATION_ITEM_ID : getItem(position).hashCode();
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return markers.size() + 1; return items.size();
} }
public MapMarker getItem(int position) { public Object getItem(int position) {
return markers.get(position - 1); return items.get(position);
} }
@Override @Override
@ -215,10 +225,12 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override @Override
public boolean onItemMove(int from, int to) { public boolean onItemMove(int from, int to) {
if (to == 0) { if (showLocationItem && to == 0) {
return false; return false;
} }
Collections.swap(markers, from - 1, to - 1); int offset = showLocationItem ? 1 : 0;
Collections.swap(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers(), from - offset, to - offset);
Collections.swap(items, from, to);
notifyItemMoved(from, to); notifyItemMoved(from, to);
return true; return true;
} }
@ -235,39 +247,83 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
private LatLon getPreviousSelectedMarkerLatLon(int currentMarkerPos) { private LatLon getPreviousSelectedMarkerLatLon(int currentMarkerPos) {
for (int i = currentMarkerPos - 1; i >= 0; i--) { for (int i = currentMarkerPos - 1; i >= 0; i--) {
MapMarker m = markers.get(i); Object item = items.get(i);
if (m.selected) { if (item instanceof MapMarker) {
return m.point; MapMarker m = (MapMarker) item;
if (m.selected) {
return m.point;
}
} }
} }
return null; return null;
} }
public void reloadData() {
items.clear();
OsmandApplication app = mapActivity.getMyApplication();
myLoc = app.getLocationProvider().getLastStaleKnownLocation();
showLocationItem = myLoc != null;
if (showLocationItem) {
lookupLocationAddress(app);
items.add(myLoc);
}
items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers());
calculateStartAndFinishPos();
}
private void lookupLocationAddress(OsmandApplication app) {
LatLon loc = new LatLon(myLoc.getLatitude(), myLoc.getLongitude());
if (locRequest == null || !locRequest.getLatLon().equals(loc)) {
if (locRequest != null) {
app.getGeocodingLookupService().cancel(locRequest);
}
locRequest = new AddressLookupRequest(loc, new OnAddressLookupResult() {
@Override
public void geocodingDone(String address) {
locRequest = null;
locDescription.setName(address);
if (showLocationItem) {
notifyItemChanged(0);
}
}
}, null);
app.getGeocodingLookupService().lookupAddress(locRequest);
}
}
public void calculateStartAndFinishPos() { public void calculateStartAndFinishPos() {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
boolean startCalculated = false; boolean startCalculated = false;
boolean finishCalculated = false; boolean finishCalculated = false;
boolean firstSelectedMarkerCalculated = false; boolean firstSelectedMarkerCalculated = false;
if (app.getMapMarkersHelper().isStartFromMyLocation() && app.getLocationProvider().getLastStaleKnownLocation() != null) { if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) {
startPos = 0; startPos = 0;
startCalculated = true; startCalculated = true;
} }
for (int i = 0; i < markers.size(); i++) { for (int i = 0; i < items.size(); i++) {
if (markers.get(i).selected) { Object item = items.get(i);
if (!startCalculated) { if (item instanceof MapMarker) {
startPos = i + 1; MapMarker m = (MapMarker) item;
startCalculated = true; if (m.selected) {
if (!startCalculated) {
startPos = i;
startCalculated = true;
}
firstSelectedMarkerPos = i;
firstSelectedMarkerCalculated = true;
break;
} }
firstSelectedMarkerPos = i + 1;
firstSelectedMarkerCalculated = true;
break;
} }
} }
for (int i = markers.size() - 1; i >= 0; i--) { for (int i = items.size() - 1; i >= 0; i--) {
if (markers.get(i).selected) { Object item = items.get(i);
finishPos = i + 1; if (item instanceof MapMarker) {
finishCalculated = true; MapMarker m = (MapMarker) item;
break; if (m.selected) {
finishPos = i;
finishCalculated = true;
break;
}
} }
} }
if (!startCalculated) { if (!startCalculated) {

View file

@ -817,7 +817,7 @@ public class MapControlsLayer extends OsmandMapLayer {
backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc)); backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc));
} }
boolean visible = !(tracked && rh.isFollowingMode()); boolean visible = !(tracked && rh.isFollowingMode());
backToLocationControl.updateVisibility(visible && !dialogOpened); backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode());
if (app.accessibilityEnabled()) { if (app.accessibilityEnabled()) {
backToLocationControl.iv.setClickable(enabled && visible); backToLocationControl.iv.setClickable(enabled && visible);
} }

View file

@ -71,7 +71,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine"); private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine");
private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont"); private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont");
private Paint paint; private final RenderingLineAttributes planRouteAttrs = new RenderingLineAttributes("markerPlanRouteline");
private TrkSegment route; private TrkSegment route;
private TIntArrayList tx = new TIntArrayList(); private TIntArrayList tx = new TIntArrayList();
@ -81,6 +81,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private ContextMenuLayer contextMenuLayer; private ContextMenuLayer contextMenuLayer;
private boolean inPlanRouteMode; private boolean inPlanRouteMode;
private boolean defaultAppMode = true;
public MapMarkersLayer(MapActivity map) { public MapMarkersLayer(MapActivity map) {
this.map = map; this.map = map;
@ -98,6 +99,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
this.inPlanRouteMode = inPlanRouteMode; this.inPlanRouteMode = inPlanRouteMode;
} }
public void setDefaultAppMode(boolean defaultAppMode) {
this.defaultAppMode = defaultAppMode;
}
private void initUI() { private void initUI() {
bitmapPaint = new Paint(); bitmapPaint = new Paint();
bitmapPaint.setDither(true); bitmapPaint.setDither(true);
@ -120,15 +125,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
bitmapPaintDestTeal = createPaintDest(R.color.marker_teal); bitmapPaintDestTeal = createPaintDest(R.color.marker_teal);
bitmapPaintDestPurple = createPaintDest(R.color.marker_purple); bitmapPaintDestPurple = createPaintDest(R.color.marker_purple);
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(7 * view.getDensity());
paint.setAntiAlias(true);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setColor(ContextCompat.getColor(map, R.color.marker_red));
paint.setAlpha(200);
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density; float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density;
textAttrs.paint.setTextSize(textSize); textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize); textAttrs.paint2.setTextSize(textSize);
@ -207,12 +203,13 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers(); List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
if (route != null && route.points.size() > 0) { if (route != null && route.points.size() > 0) {
planRouteAttrs.updatePaints(view, nightMode, tileBox);
route.renders.clear(); route.renders.clear();
route.renders.add(new Renderable.StandardTrack(new ArrayList<>(route.points), 17.2)); route.renders.add(new Renderable.StandardTrack(new ArrayList<>(route.points), 17.2));
route.drawRenderers(view.getZoom(), paint, canvas, tileBox); route.drawRenderers(view.getZoom(), defaultAppMode ? planRouteAttrs.paint : planRouteAttrs.paint2, canvas, tileBox);
} }
if (markersHelper.isStartFromMyLocation() && myLoc != null) { if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {
lineAttrs.updatePaints(view, nightMode, tileBox); lineAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint.setStyle(Paint.Style.FILL); textAttrs.paint.setStyle(Paint.Style.FILL);
@ -247,9 +244,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
float centerToMarkerDist = (float) MapUtils.getDistance(tileBox.getLatLonFromPixel(pos[0], pos[1]), marker.getLatitude(), marker.getLongitude()); float centerToMarkerDist = (float) MapUtils.getDistance(tileBox.getLatLonFromPixel(pos[0], pos[1]), marker.getLatitude(), marker.getLongitude());
String centerToMarkerDistSt = OsmAndFormatter.getFormattedDistance(centerToMarkerDist, view.getApplication()); String centerToMarkerDistSt = OsmAndFormatter.getFormattedDistance(centerToMarkerDist, view.getApplication());
if (locX >= markerX) { if (locX >= markerX) {
distanceText = centerToMarkerDistSt + " | " + generalDistSt; distanceText = centerToMarkerDistSt + " " + generalDistSt;
} else { } else {
distanceText = generalDistSt + " | " + centerToMarkerDistSt; distanceText = generalDistSt + " " + centerToMarkerDistSt;
} }
} else { } else {
distanceText = generalDistSt; distanceText = generalDistSt;