From f2a1da4ed79b70c393796ee667e315ab1cf68e1d Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Mon, 9 Oct 2017 19:04:55 +0300 Subject: [PATCH 01/21] Fix back button in landscape --- OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index a6cf75f02a..2e3e50aa86 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -670,7 +670,7 @@ public class PlanRouteFragment extends Fragment { } public boolean quit(boolean hideMarkersListFirst) { - if (planRouteContext.isMarkersListOpened() && hideMarkersListFirst) { + if (portrait && planRouteContext.isMarkersListOpened() && hideMarkersListFirst) { showHideMarkersList(); return false; } else { From d190f7e3b1e09e0dff17847cb65f4795c4e13695 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 12:02:53 +0300 Subject: [PATCH 02/21] Fix snap to road after opening in full screen; fix UI --- OsmAnd/res/layout/plan_route_toolbar_and_up_down_row.xml | 4 ---- .../src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/layout/plan_route_toolbar_and_up_down_row.xml b/OsmAnd/res/layout/plan_route_toolbar_and_up_down_row.xml index e4588da4df..900a8c58c3 100644 --- a/OsmAnd/res/layout/plan_route_toolbar_and_up_down_row.xml +++ b/OsmAnd/res/layout/plan_route_toolbar_and_up_down_row.xml @@ -109,9 +109,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" 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_marginStart="@dimen/measurement_tool_text_margin" android:ellipsize="end" android:maxLines="1" android:textAppearance="@style/TextAppearance.ListItemTitle" @@ -134,8 +132,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" 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:maxLines="1" android:textColor="?android:textColorSecondary" diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 2e3e50aa86..0cb5412410 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -78,6 +78,7 @@ public class PlanRouteFragment extends Fragment { private boolean nightMode; private boolean portrait; private boolean wasCollapseButtonVisible; + private boolean cancelSnapToRoad = true; private View mainView; private RecyclerView markersRv; @@ -305,7 +306,7 @@ public class PlanRouteFragment extends Fragment { } }); boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; - markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108)); + markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12)); markersRv.setClipToPadding(false); markersRv.setLayoutManager(new LinearLayoutManager(getContext())); markersRv.setAdapter(adapter); @@ -539,7 +540,9 @@ public class PlanRouteFragment extends Fragment { mapActivity.getMapView().setMapPosition(previousMapPosition); - planRouteContext.cancelSnapToRoad(); + if (cancelSnapToRoad) { + planRouteContext.cancelSnapToRoad(); + } markersLayer.setRoute(null); mapActivity.refreshMap(); } @@ -610,6 +613,7 @@ public class PlanRouteFragment extends Fragment { private void showHideMarkersList() { MapActivity mapActivity = getMapActivity(); if (mapActivity != null && portrait) { + cancelSnapToRoad = false; planRouteContext.setMarkersListOpened(!planRouteContext.isMarkersListOpened()); int containerRes = planRouteContext.isMarkersListOpened() ? R.id.fragmentContainer : R.id.bottomFragmentContainer; mapActivity.getSupportFragmentManager().beginTransaction() From f2ce21534b42888962ddda2b46bdd3a2a5fc00df Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 12:12:26 +0300 Subject: [PATCH 03/21] Hide back to location control in plan route mode --- OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 2f2eb8a3d2..1fd1c933c5 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -815,7 +815,7 @@ public class MapControlsLayer extends OsmandMapLayer { backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc)); } boolean visible = !(tracked && rh.isFollowingMode()); - backToLocationControl.updateVisibility(visible && !dialogOpened); + backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode()); if (app.accessibilityEnabled()) { backToLocationControl.iv.setClickable(enabled && visible); } From 6ed43e7fc11f4a477c965a937bb2e19fe81151a1 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 12:44:09 +0300 Subject: [PATCH 04/21] =?UTF-8?q?Fix=20condition=20for=20showing=20guide?= =?UTF-8?q?=20lines;=20replace=20"|"=20with=20"=E2=80=A2"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 02f6e11b29..5afa424311 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -212,7 +212,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi route.drawRenderers(view.getZoom(), paint, canvas, tileBox); } - if (markersHelper.isStartFromMyLocation() && myLoc != null) { + if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { lineAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox); textAttrs.paint.setStyle(Paint.Style.FILL); @@ -247,9 +247,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi float centerToMarkerDist = (float) MapUtils.getDistance(tileBox.getLatLonFromPixel(pos[0], pos[1]), marker.getLatitude(), marker.getLongitude()); String centerToMarkerDistSt = OsmAndFormatter.getFormattedDistance(centerToMarkerDist, view.getApplication()); if (locX >= markerX) { - distanceText = centerToMarkerDistSt + " | " + generalDistSt; + distanceText = centerToMarkerDistSt + " • " + generalDistSt; } else { - distanceText = generalDistSt + " | " + centerToMarkerDistSt; + distanceText = generalDistSt + " • " + centerToMarkerDistSt; } } else { distanceText = generalDistSt; From bb52aaaf33937a89592b679debf6bf220dd0f34a Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 13:31:28 +0300 Subject: [PATCH 05/21] Change line style for plan route --- .../plus/mapmarkers/PlanRouteFragment.java | 4 ++++ .../osmand/plus/views/MapMarkersLayer.java | 19 ++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 0cb5412410..ae1748118a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -354,6 +354,10 @@ public class PlanRouteFragment extends Fragment { @Override public void onApplicationModeItemClick(ApplicationMode mode) { if (planRouteContext.getSnappedMode() != mode) { + MapMarkersLayer layer = getMapMarkersLayer(); + if (layer != null) { + layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT); + } planRouteContext.getSnappedToRoadPoints().clear(); planRouteContext.setSnappedMode(mode); planRouteContext.recreateSnapTrkSegment(); diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 5afa424311..4b8de11729 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -71,7 +71,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine"); private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont"); - private Paint paint; + private final RenderingLineAttributes planRouteAttrs = new RenderingLineAttributes("markerPlanRouteline"); private TrkSegment route; private TIntArrayList tx = new TIntArrayList(); @@ -81,6 +81,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi private ContextMenuLayer contextMenuLayer; private boolean inPlanRouteMode; + private boolean defaultAppMode = true; public MapMarkersLayer(MapActivity map) { this.map = map; @@ -98,6 +99,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi this.inPlanRouteMode = inPlanRouteMode; } + public void setDefaultAppMode(boolean defaultAppMode) { + this.defaultAppMode = defaultAppMode; + } + private void initUI() { bitmapPaint = new Paint(); bitmapPaint.setDither(true); @@ -120,15 +125,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi bitmapPaintDestTeal = createPaintDest(R.color.marker_teal); 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; textAttrs.paint.setTextSize(textSize); textAttrs.paint2.setTextSize(textSize); @@ -207,9 +203,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi List activeMapMarkers = markersHelper.getMapMarkers(); if (route != null && route.points.size() > 0) { + planRouteAttrs.updatePaints(view, nightMode, tileBox); route.renders.clear(); 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 (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { From 78043d1d134ac121a0c3c11d181ba62bb2028a90 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 14:24:03 +0300 Subject: [PATCH 06/21] Add navigate logic --- .../plus/mapmarkers/PlanRouteFragment.java | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index ae1748118a..44a0cc1f82 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -41,6 +41,8 @@ import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; 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.helpers.AndroidUiHelper; import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener; @@ -48,6 +50,7 @@ import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback; import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment; import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener; +import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.MapMarkersLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; @@ -380,7 +383,35 @@ public class PlanRouteFragment extends Fragment { @Override public void navigateOnClick() { if (mapActivity != null) { - Toast.makeText(mapActivity, "navigate", Toast.LENGTH_SHORT).show(); + boolean hasTargets = false; + TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper(); + List 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 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); + } + 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); } } @@ -682,14 +713,17 @@ public class PlanRouteFragment extends Fragment { showHideMarkersList(); return false; } else { - dismiss(getMapActivity()); + dismiss(); return true; } } - private void dismiss(MapActivity activity) { - planRouteContext.setFragmentVisible(false); - activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); + private void dismiss() { + MapActivity activity = getMapActivity(); + if (activity != null) { + planRouteContext.setFragmentVisible(false); + activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); + } } public static boolean showInstance(MapActivity mapActivity) { From 73d9b1db69f9e107d272b9f38b45a02ca58089c5 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 15:05:56 +0300 Subject: [PATCH 07/21] Add reorder icon to location item --- .../plus/mapmarkers/adapters/MapMarkersListAdapter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index d906631937..ca0bd2977e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -99,6 +99,8 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Tue, 10 Oct 2017 16:39:43 +0300 Subject: [PATCH 08/21] Add round trip --- .../src/net/osmand/plus/OsmandSettings.java | 1 + .../mapmarkers/MarkersPlanRouteContext.java | 4 ++++ .../plus/mapmarkers/PlanRouteFragment.java | 20 +++++++++++++++++-- ...RouteOptionsBottomSheetDialogFragment.java | 3 +++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 3a6c93c897..d47e86a15c 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1337,6 +1337,7 @@ public class OsmandSettings { public final OsmandPreference ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache(); public final OsmandPreference ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache(); + public final OsmandPreference ROUTE_MAP_MARKERS_ROUND_TRIP = new BooleanPreference("route_map_markers_round_trip", false).makeGlobal().cache(); public ITileSource getMapTileSource(boolean warnWhenSelected) { String tileName = MAP_TILE_SOURCES.get(); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java index 95f271880f..c7f9ba3dcc 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java @@ -172,6 +172,10 @@ public class MarkersPlanRouteContext { for (LatLon l : markersHelper.getSelectedMarkersLatLon()) { addWptPt(points, l.getLatitude(), l.getLongitude()); } + if (app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get()) { + WptPt l = points.get(0); + addWptPt(points, l.getLatitude(), l.getLongitude()); + } return points; } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 44a0cc1f82..229d383a5e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -24,12 +24,12 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; -import android.widget.Toast; import net.osmand.AndroidUtils; import net.osmand.Location; import net.osmand.TspAnt; import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; import net.osmand.data.RotatedTileBox; import net.osmand.plus.ApplicationMode; import net.osmand.plus.GPXUtilities.TrkSegment; @@ -402,6 +402,20 @@ public class PlanRouteFragment extends Fragment { 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); @@ -418,7 +432,9 @@ public class PlanRouteFragment extends Fragment { @Override public void makeRoundTripOnClick() { 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(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java index 48ef2ffb51..42e3ed58f0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java @@ -13,6 +13,7 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; +import android.widget.CompoundButton; import android.widget.ImageView; 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.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) { ((ImageView) mainView.findViewById(R.id.select_icon)) .setImageDrawable(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all)); From 9e650613017ad9abd06eac74a436adc40d12057f Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 19:12:53 +0300 Subject: [PATCH 09/21] Hide location item if location is not available --- .../mapmarkers/MarkersPlanRouteContext.java | 2 +- .../plus/mapmarkers/PlanRouteFragment.java | 9 +- .../adapters/MapMarkersListAdapter.java | 86 ++++++++++++------- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java index c7f9ba3dcc..569b01afe0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java @@ -172,7 +172,7 @@ public class MarkersPlanRouteContext { for (LatLon l : markersHelper.getSelectedMarkersLatLon()) { addWptPt(points, l.getLatitude(), l.getLongitude()); } - if (app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get()) { + if (app.getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get() && !points.isEmpty()) { WptPt l = points.get(0); addWptPt(points, l.getLatitude(), l.getLongitude()); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 229d383a5e..920ce5e274 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -270,10 +270,11 @@ public class PlanRouteFragment extends Fragment { if (pos == RecyclerView.NO_POSITION) { 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()); - } else { - MapMarker marker = adapter.getItem(pos); + } else if (item instanceof MapMarker) { + MapMarker marker = (MapMarker) item; selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; marker.selected = !marker.selected; markersHelper.updateMapMarker(marker, false); @@ -454,6 +455,7 @@ public class PlanRouteFragment extends Fragment { public void reverseOrderOnClick() { if (mapActivity != null) { markersHelper.reverseActiveMarkersOrder(); + adapter.reloadData(); adapter.calculateStartAndFinishPos(); adapter.notifyDataSetChanged(); planRouteContext.recreateSnapTrkSegment(); @@ -813,6 +815,7 @@ public class PlanRouteFragment extends Fragment { } mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res); + adapter.reloadData(); adapter.calculateStartAndFinishPos(); adapter.notifyDataSetChanged(); planRouteContext.recreateSnapTrkSegment(); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index ca0bd2977e..62d8f68722 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -23,6 +23,7 @@ import net.osmand.util.MapUtils; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; +import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; @@ -33,13 +34,16 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter markers; + private List items = new LinkedList<>(); private MapMarkersListAdapterListener listener; private int startPos = -1; private int finishPos = -1; private int firstSelectedMarkerPos = -1; + private boolean showLocationItem; + private Location myLoc; + private Map, List> snappedToRoadPoints; public void setAdapterListener(MapMarkersListAdapterListener listener) { @@ -52,7 +56,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter= 0; i--) { - MapMarker m = markers.get(i); - if (m.selected) { - return m.point; + Object item = items.get(i); + if (item instanceof MapMarker) { + MapMarker m = (MapMarker) item; + if (m.selected) { + return m.point; + } } } return null; } + public void reloadData() { + items.clear(); + myLoc = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); + showLocationItem = myLoc != null; + if (showLocationItem) { + items.add(myLoc); + } + items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers()); + } + public void calculateStartAndFinishPos() { OsmandApplication app = mapActivity.getMyApplication(); boolean startCalculated = false; boolean finishCalculated = false; boolean firstSelectedMarkerCalculated = false; - if (app.getMapMarkersHelper().isStartFromMyLocation() && app.getLocationProvider().getLastStaleKnownLocation() != null) { + if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) { startPos = 0; startCalculated = true; } - for (int i = 0; i < markers.size(); i++) { - if (markers.get(i).selected) { - if (!startCalculated) { - startPos = i + 1; - startCalculated = true; + for (int i = 0; i < items.size(); i++) { + Object item = items.get(i); + if (item instanceof MapMarker) { + MapMarker m = (MapMarker) item; + if (m.selected) { + if (!startCalculated) { + startPos = i; + startCalculated = true; + } + firstSelectedMarkerPos = i + 1; + firstSelectedMarkerCalculated = true; + break; } - firstSelectedMarkerPos = i + 1; - firstSelectedMarkerCalculated = true; - break; } } - for (int i = markers.size() - 1; i >= 0; i--) { - if (markers.get(i).selected) { - finishPos = i + 1; - finishCalculated = true; - break; + for (int i = items.size() - 1; i >= 0; i--) { + Object item = items.get(i); + if (item instanceof MapMarker) { + MapMarker m = (MapMarker) item; + if (m.selected) { + finishPos = i; + finishCalculated = true; + break; + } } } if (!startCalculated) { From 68a6560e3e431e2874b792b9e78ffd3121e05e3a Mon Sep 17 00:00:00 2001 From: xmd5a Date: Wed, 11 Oct 2017 00:02:38 +0300 Subject: [PATCH 10/21] Add phrases --- OsmAnd/res/values/phrases.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index a90eb1cedf..1f42b9f5ce 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -3485,4 +3485,8 @@ VHF channel + Gorge + Couloir + Mountain area + From 4e5f769ba9de823879ca07a448d5bd21afefeea7 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 11 Oct 2017 09:52:42 +0300 Subject: [PATCH 11/21] Extract padding from item to recycler view --- OsmAnd/res/layout/map_marker_item_new.xml | 15 ++++----------- .../osmand/plus/mapmarkers/PlanRouteFragment.java | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/OsmAnd/res/layout/map_marker_item_new.xml b/OsmAnd/res/layout/map_marker_item_new.xml index 96c4cff626..3bdea75231 100644 --- a/OsmAnd/res/layout/map_marker_item_new.xml +++ b/OsmAnd/res/layout/map_marker_item_new.xml @@ -7,21 +7,14 @@ android:descendantFocusability="blocksDescendants" android:orientation="vertical"> - - - - - - - + tools:visibility="visible"/> Date: Wed, 11 Oct 2017 12:01:27 +0300 Subject: [PATCH 12/21] Show address in location item; fix distance calculation --- .../adapters/MapMarkersListAdapter.java | 54 ++++++++++++++----- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index 62d8f68722..cdfed89b48 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -11,7 +11,10 @@ import android.view.ViewGroup; import net.osmand.Location; import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; 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.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; @@ -43,6 +46,8 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter, List> snappedToRoadPoints; @@ -55,6 +60,8 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Wed, 11 Oct 2017 13:36:15 +0300 Subject: [PATCH 13/21] Add location listener --- .../plus/mapmarkers/PlanRouteFragment.java | 48 +++++++++++++++++-- .../adapters/MapMarkersListAdapter.java | 1 + 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index c053cfdd67..e5fb0be4e9 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -38,6 +38,7 @@ 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.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; @@ -62,7 +63,7 @@ import java.util.List; 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"; @@ -83,6 +84,8 @@ public class PlanRouteFragment extends Fragment { private boolean wasCollapseButtonVisible; private boolean cancelSnapToRoad = true; + private Location location; + private View mainView; private RecyclerView markersRv; @@ -255,7 +258,6 @@ public class PlanRouteFragment extends Fragment { adapter = new MapMarkersListAdapter(mapActivity); adapter.setHasStableIds(true); - adapter.calculateStartAndFinishPos(); adapter.setSnappedToRoadPoints(planRouteContext.getSnappedToRoadPoints()); final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(adapter)); touchHelper.attachToRecyclerView(markersRv); @@ -322,12 +324,52 @@ public class PlanRouteFragment extends Fragment { 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 public void onDestroyView() { super.onDestroyView(); exitPlanRouteMode(); } + @Override + public void updateLocation(Location loc) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + 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(); + if (newLocation || locationChanged) { + 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() { return (MapActivity) getActivity(); } @@ -456,7 +498,6 @@ public class PlanRouteFragment extends Fragment { if (mapActivity != null) { markersHelper.reverseActiveMarkersOrder(); adapter.reloadData(); - adapter.calculateStartAndFinishPos(); adapter.notifyDataSetChanged(); planRouteContext.recreateSnapTrkSegment(); } @@ -816,7 +857,6 @@ public class PlanRouteFragment extends Fragment { mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res); adapter.reloadData(); - adapter.calculateStartAndFinishPos(); adapter.notifyDataSetChanged(); planRouteContext.recreateSnapTrkSegment(); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index cdfed89b48..92bfb3d868 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -268,6 +268,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Wed, 11 Oct 2017 14:10:09 +0300 Subject: [PATCH 14/21] Recalculate only if my location changed by 50 meters --- OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index e5fb0be4e9..f833b4e9a5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -66,6 +66,7 @@ import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; public class PlanRouteFragment extends Fragment implements OsmAndLocationListener { public static final String TAG = "PlanRouteFragment"; + private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters private MapMarkersHelper markersHelper; private MarkersPlanRouteContext planRouteContext; @@ -357,7 +358,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene boolean locationChanged = this.location != null && location != null && this.location.getLatitude() != location.getLatitude() && this.location.getLongitude() != location.getLongitude(); - if (newLocation || locationChanged) { + boolean farEnough = locationChanged && MapUtils.getDistance(this.location.getLatitude(), this.location.getLongitude(), + location.getLatitude(), location.getLongitude()) >= MIN_DISTANCE_FOR_RECALCULATE; + if (newLocation || farEnough) { this.location = location; adapter.reloadData(); try { From fc3c3f45ef7ebfb5b576e287f39b1b4c0c672a28 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 11 Oct 2017 14:32:54 +0300 Subject: [PATCH 15/21] Use ui thread for adapter updates --- .../plus/mapmarkers/PlanRouteFragment.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index f833b4e9a5..f71e2c3daa 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -353,7 +353,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene public void updateLocation(Location loc) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - Location location = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); + 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() @@ -361,14 +361,19 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene boolean farEnough = locationChanged && MapUtils.getDistance(this.location.getLatitude(), this.location.getLongitude(), location.getLatitude(), location.getLongitude()) >= MIN_DISTANCE_FOR_RECALCULATE; if (newLocation || farEnough) { - 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 - } + 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 + } + } + }); } } } From 654ce8fa457b769d7802cfdd8f1c46d1afb28ebc Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 11 Oct 2017 14:59:21 +0300 Subject: [PATCH 16/21] Fix context menu margin --- .../plus/mapcontextmenu/MapContextMenuFragment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 7fd532ccf2..3f83428f8c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -889,26 +889,31 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents { } int dp16 = dpToPx(16f); + boolean has16margin = false; int titleButtonHeight = 0; View titleButtonContainer = view.findViewById(R.id.title_button_container); if (titleButtonContainer.getVisibility() == View.VISIBLE) { titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16; if (titleButtonHeight < 0) { titleButtonHeight = 0; + } else { + has16margin = true; } } int downloadButtonsHeight = 0; View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container); if (downloadButtonsContainer.getVisibility() == View.VISIBLE) { - downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - dp16; + downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); if (downloadButtonsHeight < 0) { downloadButtonsHeight = 0; + } else { + has16margin = true; } } int titleProgressHeight = 0; View titleProgressContainer = view.findViewById(R.id.title_progress_container); if (titleProgressContainer.getVisibility() == View.VISIBLE) { - titleProgressHeight = titleProgressContainer.getMeasuredHeight() - dp16; + titleProgressHeight = titleProgressContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); if (titleProgressHeight < 0) { titleProgressHeight = 0; } From 8371a67fdbaf450255a1127b23b0851c345ff847 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 11 Oct 2017 15:45:32 +0300 Subject: [PATCH 17/21] Fix #4506 --- .../controllers/RenderedObjectMenuController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java index 92b64d4a1f..eac1f7675b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/RenderedObjectMenuController.java @@ -55,7 +55,7 @@ public class RenderedObjectMenuController extends MenuController { @Override public String getNameStr() { - if (!Algorithms.isEmpty(renderedObject.getName())) { + if (!Algorithms.isEmpty(renderedObject.getName()) && !isStartingWithRTLChar(renderedObject.getName())) { return renderedObject.getName(); } else if (renderedObject.getTags().size() > 0) { String lang = getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get().toLowerCase(); @@ -67,6 +67,8 @@ public class RenderedObjectMenuController extends MenuController { name = renderedObject.getTags().get("name"); } return name; + } else if (!Algorithms.isEmpty(renderedObject.getName())) { + return renderedObject.getName(); } return ""; } @@ -97,4 +99,13 @@ public class RenderedObjectMenuController extends MenuController { } 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; + } + } From 0560505af30e3dbf18fb36a581d21f09d613f38f Mon Sep 17 00:00:00 2001 From: Dmitriy Prodchenko Date: Wed, 11 Oct 2017 17:30:04 +0300 Subject: [PATCH 18/21] Change string. --- OsmAnd/res/values-ru/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 156a298ff9..a475a35b4e 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -2490,7 +2490,7 @@ %1$d из %2$d Список Группы - Последнее использование: %1$s + Пройдено: %1$s Сделать активным Сегодня Вчера From 98aee665328c60ccc087a2b412274031868fd6df Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 11 Oct 2017 17:54:58 +0300 Subject: [PATCH 19/21] Fix #4306 --- .../mapcontextmenu/controllers/AmenityMenuController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index e9a988283b..55f712ba66 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -11,6 +11,7 @@ import net.osmand.data.TransportStop; import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiFilter; import net.osmand.osm.PoiType; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.MapContextMenu; @@ -104,6 +105,12 @@ public class AmenityMenuController extends MenuController { 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 public String getTypeStr() { return getTypeStr(amenity); From 1232006afcc46b1f7886107c61606aaa26d92544 Mon Sep 17 00:00:00 2001 From: xmd5a Date: Wed, 11 Oct 2017 18:42:10 +0300 Subject: [PATCH 20/21] Add phrases --- OsmAnd/res/values-ru/phrases.xml | 2 ++ OsmAnd/res/values/phrases.xml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 36db4c9c33..9ea0a07c9e 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -3508,4 +3508,6 @@ Транспортное учреждение Законодательное учреждение + Глина + diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 1f42b9f5ce..048e7baa54 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -3489,4 +3489,10 @@ Couloir Mountain area + Clay + Tartan + Artificial turf + DecoTurf + Metal grid + From d68606bd5de11ae0f2bf82cc069b49e9f537f9e1 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 11 Oct 2017 19:12:53 +0300 Subject: [PATCH 21/21] Try to fix slope chart --- OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 0e25d29d7c..59f3a88b08 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -1440,7 +1440,7 @@ public class GpxUiHelper { 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 (useRightAxis) {