From 92098463395ed823b95e93a88d25ca512214edd8 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Tue, 16 Feb 2021 18:34:46 +0300 Subject: [PATCH 01/13] Fix Amazon free icon --- OsmAnd/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index 11c9388fa0..91a8ce39ab 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -85,6 +85,7 @@ android { } amazonFree { java.srcDirs = ["src-nogms", "src-google"] + manifest.srcFile "AndroidManifest-gplayFree.xml" } amazonFull { java.srcDirs = ["src-nogms", "src-google"] From 44429d7232fb8316dd2ba9a7fb6d11ec4296447e Mon Sep 17 00:00:00 2001 From: Skalii Date: Tue, 16 Feb 2021 20:01:41 +0200 Subject: [PATCH 02/13] fix show keyboard after open osm note --- .../net/osmand/plus/osmedit/dialogs/BugBottomSheetDialog.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/BugBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/BugBottomSheetDialog.java index 7b4067c2f7..5104e98c03 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/BugBottomSheetDialog.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/BugBottomSheetDialog.java @@ -64,6 +64,9 @@ public class BugBottomSheetDialog extends MenuBottomSheetDialogFragment { textBox.setDefaultHintTextColor(colorStateList); noteText = osmNoteView.findViewById(R.id.name_edit_text); noteText.setText(text); + if (noteText.requestFocus()) { + AndroidUtils.showSoftKeyboard(getActivity(), noteText); + } BaseBottomSheetItem editOsmNote = new BaseBottomSheetItem.Builder() .setCustomView(osmNoteView) From 25744449aff4d656c15b8feb2c28881046c697cb Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Tue, 16 Feb 2021 21:44:33 +0200 Subject: [PATCH 03/13] Add "Russia", "Canada", "USA" Don't show country name in for the maps: "Germany Bavaria" > "Bavaria" --- .../main/java/net/osmand/map/WorldRegion.java | 27 ++++++++++++------- .../plus/download/DownloadResources.java | 10 +++++-- .../download/MultipleIndexesUiHelper.java | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/map/WorldRegion.java b/OsmAnd-java/src/main/java/net/osmand/map/WorldRegion.java index 99eca34f19..b6fdb4f7d4 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/WorldRegion.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/WorldRegion.java @@ -76,12 +76,12 @@ public class WorldRegion implements Serializable { } } - - + + public boolean isRegionMapDownload() { return regionMapDownload; } - + public String getLocaleName() { if(!Algorithms.isEmpty(regionNameLocale)) { return regionNameLocale; @@ -92,14 +92,14 @@ public class WorldRegion implements Serializable { if(!Algorithms.isEmpty(regionName)) { return regionName; } - + return capitalize(regionFullName.replace('_', ' ')); } - + public String getRegionDownloadName() { return regionDownloadName; } - + public String getRegionDownloadNameLC() { return regionDownloadName == null ? null : regionDownloadName.toLowerCase(); } @@ -111,7 +111,7 @@ public class WorldRegion implements Serializable { public LatLon getRegionCenter() { return regionCenter; } - + public String getRegionSearchText() { return regionSearchText; } @@ -145,7 +145,7 @@ public class WorldRegion implements Serializable { this.regionDownloadName = downloadName; superregion = null; subregions = new LinkedList(); - + } public WorldRegion(String id) { this(id, null); @@ -154,7 +154,7 @@ public class WorldRegion implements Serializable { public String getRegionId() { return regionFullName; } - + private String capitalize(String s) { String[] words = s.split(" "); if (words[0].length() > 0) { @@ -191,4 +191,13 @@ public class WorldRegion implements Serializable { } return false; } + + public boolean isContinent() { + if (superregion != null) { + String superRegionId = superregion.getRegionId(); + String thisRegionId = getRegionId(); + return WORLD.equals(superRegionId) && !RUSSIA_REGION_ID.equals(thisRegionId); + } + return false; + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java index 66a6621851..a90275c40d 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java @@ -418,12 +418,14 @@ public class DownloadResources extends DownloadResourceGroup { mainGrp.region = reg; parentGroup.addGroup(mainGrp); + DownloadResourceGroup flatFiles = new DownloadResourceGroup(mainGrp, REGION_MAPS); List list = groupByRegion.get(reg); if (list != null) { - DownloadResourceGroup flatFiles = new DownloadResourceGroup(mainGrp, REGION_MAPS); for (IndexItem ii : list) { flatFiles.addItem(ii); } + } + if (list != null || !reg.isContinent()) { mainGrp.addGroup(flatFiles); } DownloadResourceGroup subRegions = new DownloadResourceGroup(mainGrp, DownloadResourceGroupType.SUBREGIONS); @@ -467,12 +469,16 @@ public class DownloadResources extends DownloadResourceGroup { addGroup(otherGroup); createHillshadeSRTMGroups(); + collectMultipleIndexesItems(); trimEmptyGroups(); updateLoadedFiles(); - collectMultipleIndexesItems(region); return true; } + private void collectMultipleIndexesItems() { + collectMultipleIndexesItems(region); + } + private void collectMultipleIndexesItems(@NonNull WorldRegion region) { List subRegions = region.getSubregions(); if (Algorithms.isEmpty(subRegions)) return; diff --git a/OsmAnd/src/net/osmand/plus/download/MultipleIndexesUiHelper.java b/OsmAnd/src/net/osmand/plus/download/MultipleIndexesUiHelper.java index c7e9a05b66..f84da0a74a 100644 --- a/OsmAnd/src/net/osmand/plus/download/MultipleIndexesUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/MultipleIndexesUiHelper.java @@ -29,7 +29,7 @@ public class MultipleIndexesUiHelper { OsmandRegions osmandRegions = app.getRegions(); for (IndexItem indexItem : multipleIndexItem.getAllIndexes()) { SelectableItem selectableItem = new SelectableItem(); - selectableItem.setTitle(indexItem.getVisibleName(app, osmandRegions)); + selectableItem.setTitle(indexItem.getVisibleName(app, osmandRegions, false)); String size = indexItem.getSizeDescription(app); String date = indexItem.getDate(dateFormat, showRemoteDate); From c941880444c42ed55e5a47060a0b8b3cb37ed250 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 17 Feb 2021 15:02:26 +0200 Subject: [PATCH 04/13] Fix reverse for multisegment --- .../FollowTrackFragment.java | 24 +++++++++---------- .../osmand/plus/routing/RouteProvider.java | 6 ++++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index 82a8ea2d88..dc2d1ec79e 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -226,16 +226,14 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca GPXRouteParamsBuilder rparams = routingHelper.getCurrentGPXRoute(); boolean osmandRouter = mode.getRouteService() == RouteProvider.RouteService.OSMAND; if (rparams != null && osmandRouter) { - boolean showReverseCard = !routingHelper.isCurrentGPXRouteV2(); - if (showReverseCard) { - cardsContainer.addView(buildDividerView(cardsContainer, false)); + cardsContainer.addView(buildDividerView(cardsContainer, false)); + + ReverseTrackCard reverseTrackCard = new ReverseTrackCard(mapActivity, rparams.isReverse()); + reverseTrackCard.setListener(this); + cardsContainer.addView(reverseTrackCard.build(mapActivity)); - ReverseTrackCard reverseTrackCard = new ReverseTrackCard(mapActivity, rparams.isReverse()); - reverseTrackCard.setListener(this); - cardsContainer.addView(reverseTrackCard.build(mapActivity)); - } if (!gpxFile.hasRtePt() && !gpxFile.hasRoute()) { - cardsContainer.addView(buildDividerView(cardsContainer, showReverseCard)); + cardsContainer.addView(buildDividerView(cardsContainer, true)); AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity); attachTrackCard.setListener(this); @@ -721,11 +719,11 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca @Override public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) { selectTrackToFollow(gpxFile); - GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute(); - if (paramsBuilder != null) { - paramsBuilder.setSelectedSegment(selectedSegment); - app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment); - app.getRoutingHelper().onSettingsChanged(true); + GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute(); + if (paramsBuilder != null) { + paramsBuilder.setSelectedSegment(selectedSegment); + app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment); + app.getRoutingHelper().onSettingsChanged(true); } updateSelectionMode(false); } diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 051a5218fa..eb1ffedae5 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -289,7 +289,11 @@ public class RouteProvider { int selectedSegment = builder.getSelectedSegment(); if (OSMAND_ROUTER_V2.equals(file.author)) { route = parseOsmAndGPXRoute(points, file, selectedSegment); - routePoints = file.getRoutePoints(); + if (selectedSegment == -1) { + routePoints = file.getRoutePoints(); + } else { + routePoints = file.getRoutePoints(selectedSegment); + } if (reverse) { Collections.reverse(points); Collections.reverse(routePoints); From 05271e8ac5725e3c4ff9826611f4d7b5a05b8700 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 17 Feb 2021 16:02:00 +0200 Subject: [PATCH 05/13] Show attach roads for multitrack --- .../MeasurementEditingContext.java | 132 ++++++++++-------- .../FollowTrackFragment.java | 1 + 2 files changed, 77 insertions(+), 56 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 74094cd07b..3512de68bc 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -62,6 +62,7 @@ public class MeasurementEditingContext implements IRouteSettingsListener { private List afterSegmentsForSnap; private GpxData gpxData; + private int selectedSegment = -1; private int selectedPointPosition = -1; private WptPt originalPointToMove; @@ -180,6 +181,10 @@ public class MeasurementEditingContext implements IRouteSettingsListener { this.gpxData = gpxData; } + public void setSelectedSegment(int selectedSegment) { + this.selectedSegment = selectedSegment; + } + public boolean hasRoutePoints() { return gpxData != null && gpxData.getGpxFile() != null && gpxData.getGpxFile().hasRtePt(); } @@ -688,7 +693,7 @@ public class MeasurementEditingContext implements IRouteSettingsListener { return res; } - private List> getOrderedRoadSegmentDataKeys() { + private List> getOrderedRoadSegmentDataKeys() { List> keys = new ArrayList<>(); for (List points : Arrays.asList(before.points, after.points)) { for (int i = 0; i < points.size() - 1; i++) { @@ -697,7 +702,7 @@ public class MeasurementEditingContext implements IRouteSettingsListener { } return keys; } - + private void recreateSegments(List segments, List segmentsForSnap, List points, boolean calculateIfNeeded) { List roadSegmentIndexes = new ArrayList<>(); TrkSegment s = new TrkSegment(); @@ -767,67 +772,82 @@ public class MeasurementEditingContext implements IRouteSettingsListener { if (Algorithms.isEmpty(segments)) { return; } - for (int si = 0; si < segments.size(); si++) { - TrkSegment segment = segments.get(si); - List points = segment.points; + if (selectedSegment != -1 && segments.size() > selectedSegment) { + TrkSegment segment = segments.get(selectedSegment); if (segment.hasRoute()) { - RouteImporter routeImporter = new RouteImporter(segment); - List routeSegments = routeImporter.importRoute(); - List routePoints = gpxData.getGpxFile().getRoutePoints(si); - int prevPointIndex = 0; - if (routePoints.isEmpty() && points.size() > 1) { - routePoints.add(points.get(0)); - routePoints.add(points.get(points.size() - 1)); - } - for (int i = 0; i < routePoints.size() - 1; i++) { - Pair pair = new Pair<>(routePoints.get(i), routePoints.get(i + 1)); - int startIndex = pair.first.getTrkPtIndex(); - if (startIndex < 0 || startIndex < prevPointIndex || startIndex >= points.size()) { - startIndex = MeasurementEditingContextUtils.findPointIndex(pair.first, points, prevPointIndex); - } - int endIndex = pair.second.getTrkPtIndex(); - if (endIndex < 0 || endIndex < startIndex || endIndex >= points.size()) { - endIndex = MeasurementEditingContextUtils.findPointIndex(pair.second, points, startIndex); - } - if (startIndex >= 0 && endIndex >= 0) { - List pairPoints = new ArrayList<>(); - for (int j = startIndex; j < endIndex && j < points.size(); j++) { - pairPoints.add(points.get(j)); - prevPointIndex = j; - } - if (points.size() > prevPointIndex + 1 && i == routePoints.size() - 2) { - pairPoints.add(points.get(prevPointIndex + 1)); - } - Iterator it = routeSegments.iterator(); - int k = endIndex - startIndex - 1; - List pairSegments = new ArrayList<>(); - if (k == 0 && !routeSegments.isEmpty()) { - pairSegments.add(routeSegments.remove(0)); - } else { - while (it.hasNext() && k > 0) { - RouteSegmentResult s = it.next(); - pairSegments.add(s); - it.remove(); - k -= Math.abs(s.getEndPointIndex() - s.getStartPointIndex()); - } - } - ApplicationMode appMode = ApplicationMode.valueOfStringKey(pair.first.getProfileType(), DEFAULT_APP_MODE); - roadSegmentData.put(pair, new RoadSegmentData(appMode, pair.first, pair.second, pairPoints, pairSegments)); - } - } - if (!routePoints.isEmpty() && si < segments.size() - 1) { - routePoints.get(routePoints.size() - 1).setGap(); - } - addPoints(routePoints); + addPoints(collectRoutePointsFromSegment(segment, selectedSegment)); } else { - addPoints(points); - if (!points.isEmpty() && si < segments.size() - 1) { - points.get(points.size() - 1).setGap(); + addPoints(segment.points); + } + } else { + for (int si = 0; si < segments.size(); si++) { + TrkSegment segment = segments.get(si); + if (segment.hasRoute()) { + List routePoints = collectRoutePointsFromSegment(segment, si); + if (!routePoints.isEmpty() && si < segments.size() - 1) { + routePoints.get(routePoints.size() - 1).setGap(); + } + addPoints(routePoints); + } else { + List points = segment.points; + addPoints(points); + if (!points.isEmpty() && si < segments.size() - 1) { + points.get(points.size() - 1).setGap(); + } } } } } + private List collectRoutePointsFromSegment(TrkSegment segment, int segmentIndex) { + RouteImporter routeImporter = new RouteImporter(segment); + List routeSegments = routeImporter.importRoute(); + List routePoints = gpxData.getGpxFile().getRoutePoints(segmentIndex); + int prevPointIndex = 0; + List points = segment.points; + if (routePoints.isEmpty() && points.size() > 1) { + routePoints.add(points.get(0)); + routePoints.add(points.get(points.size() - 1)); + } + for (int i = 0; i < routePoints.size() - 1; i++) { + Pair pair = new Pair<>(routePoints.get(i), routePoints.get(i + 1)); + int startIndex = pair.first.getTrkPtIndex(); + if (startIndex < 0 || startIndex < prevPointIndex || startIndex >= points.size()) { + startIndex = MeasurementEditingContextUtils.findPointIndex(pair.first, points, prevPointIndex); + } + int endIndex = pair.second.getTrkPtIndex(); + if (endIndex < 0 || endIndex < startIndex || endIndex >= points.size()) { + endIndex = MeasurementEditingContextUtils.findPointIndex(pair.second, points, startIndex); + } + if (startIndex >= 0 && endIndex >= 0) { + List pairPoints = new ArrayList<>(); + for (int j = startIndex; j < endIndex && j < points.size(); j++) { + pairPoints.add(points.get(j)); + prevPointIndex = j; + } + if (points.size() > prevPointIndex + 1 && i == routePoints.size() - 2) { + pairPoints.add(points.get(prevPointIndex + 1)); + } + Iterator it = routeSegments.iterator(); + int k = endIndex - startIndex - 1; + List pairSegments = new ArrayList<>(); + if (k == 0 && !routeSegments.isEmpty()) { + pairSegments.add(routeSegments.remove(0)); + } else { + while (it.hasNext() && k > 0) { + RouteSegmentResult s = it.next(); + pairSegments.add(s); + it.remove(); + k -= Math.abs(s.getEndPointIndex() - s.getStartPointIndex()); + } + } + ApplicationMode appMode = ApplicationMode.valueOfStringKey(pair.first.getProfileType(), DEFAULT_APP_MODE); + roadSegmentData.put(pair, new RoadSegmentData(appMode, pair.first, pair.second, pairPoints, pairSegments)); + } + } + return routePoints; + } + public List setPoints(GpxRouteApproximation gpxApproximation, List originalPoints, ApplicationMode mode) { if (gpxApproximation == null || Algorithms.isEmpty(gpxApproximation.finalPoints) || Algorithms.isEmpty(gpxApproximation.result)) { return null; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index dc2d1ec79e..067c09025e 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -582,6 +582,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca MeasurementEditingContext editingContext = new MeasurementEditingContext(); editingContext.setGpxData(gpxData); editingContext.setAppMode(app.getRoutingHelper().getAppMode()); + editingContext.setSelectedSegment(app.getSettings().GPX_ROUTE_SEGMENT.get()); MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true); } } From bf5b797aaa73ea905b1f657cb70db707128f96b6 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 17 Feb 2021 16:11:47 +0100 Subject: [PATCH 06/13] Fix #10922 --- .../plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java index 641cee51cc..80613e0df0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java @@ -46,12 +46,12 @@ public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragme @Override protected int getDismissButtonTextId() { - return R.string.shared_string_cancel; + return R.string.shared_string_no; } @Override protected int getRightBottomButtonTextId() { - return R.string.shared_string_dismiss; + return R.string.shared_string_yes; } @Override From 5081ffd41dc407aeed27d6ad2753fc6542d28d2e Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 17 Feb 2021 17:15:06 +0200 Subject: [PATCH 07/13] Review After changing segments using "Select another track" without closing RP, the last point of the previously selected segment will be added as a destination point. @androiddevkotlin Don't show route points quantity, on the second line we show only waypoints quantity @androiddevkotlin --- .../osmand/plus/helpers/TrackSelectSegmentAdapter.java | 10 ++++++---- .../plus/routepreparationmenu/FollowTrackFragment.java | 2 +- .../plus/routepreparationmenu/cards/TrackEditCard.java | 10 ++++++++-- .../src/net/osmand/plus/track/TrackMenuFragment.java | 2 +- .../plus/track/TrackSelectSegmentBottomSheet.java | 9 ++++++++- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java b/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java index 498f638081..e9b1a67ce3 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java +++ b/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java @@ -28,6 +28,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter segments; private OnItemClickListener onItemClickListener; + private ImageView timeIcon; public TrackSelectSegmentAdapter(Context ctx, List segments) { app = (OsmandApplication) ctx.getApplicationContext(); @@ -42,14 +43,14 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter 1 && routeParams != null && routeParams.getSelectedSegment() != -1) { TextView distanceView = view.findViewById(R.id.distance); TextView timeView = view.findViewById(R.id.time); + ImageView timeIcon = view.findViewById(R.id.time_icon); TextView pointsView = view.findViewById(R.id.points_count); + ImageView pointsIcon = view.findViewById(R.id.points_icon); + pointsView.setVisibility(View.GONE); + pointsIcon.setVisibility(View.GONE); List segments = gpxFile.getNonEmptyTrkSegments(false); GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); - int point = segment.points.size(); double distance = TrackSelectSegmentAdapter.getDistance(segment); long time = TrackSelectSegmentAdapter.getSegmentTime(segment); if (time != 1) { timeView.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000))); } else { + timeIcon.setVisibility(View.GONE); timeView.setText(""); } distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); - pointsView.setText(String.valueOf(point)); } ImageButton editButton = view.findViewById(R.id.show_on_map); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index e0a7290b33..fb72c0a9c8 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -1090,10 +1090,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) { + app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment); MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { startNavigationForGPX(gpxFile, mapActivity.getMapActions()); - app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment); RouteProvider.GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute(); if (paramsBuilder != null) { paramsBuilder.setSelectedSegment(selectedSegment); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java b/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java index b49c2eb898..cc60c4f057 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java @@ -81,6 +81,7 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment TextView distance = gpxTrackContainer.findViewById(R.id.distance); TextView pointsCount = gpxTrackContainer.findViewById(R.id.points_count); TextView time = gpxTrackContainer.findViewById(R.id.time); + ImageView timeIcon = gpxTrackContainer.findViewById(R.id.time_icon); LinearLayout container = gpxTrackContainer.findViewById(R.id.container); LinearLayout containerNameAndReadSection = gpxTrackContainer.findViewById(R.id.name_and_read_section_container); container.setPadding(sidePadding, 0, 0, 0); @@ -93,7 +94,13 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment pointsCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); pointsCount.setText(String.valueOf(analysis.wptPoints)); time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); - time.setText(analysis.isTimeSpecified() ? Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()) : ""); + if (analysis.isTimeSpecified()) { + time.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000), + app.accessibilityEnabled())); + } else { + time.setText(""); + timeIcon.setVisibility(View.GONE); + } RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); From 7d8886f757ed7e288974bbef62101c0129a628b4 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 17 Feb 2021 23:00:23 +0200 Subject: [PATCH 08/13] Fix of possible bugs --- .../osmand/plus/helpers/TrackSelectSegmentAdapter.java | 8 +++++--- .../plus/routepreparationmenu/FollowTrackFragment.java | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java b/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java index e9b1a67ce3..802e6d1441 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java +++ b/OsmAnd/src/net/osmand/plus/helpers/TrackSelectSegmentAdapter.java @@ -28,7 +28,6 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter segments; private OnItemClickListener onItemClickListener; - private ImageView timeIcon; public TrackSelectSegmentAdapter(Context ctx, List segments) { app = (OsmandApplication) ctx.getApplicationContext(); @@ -43,7 +42,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter Date: Thu, 18 Feb 2021 11:41:31 +0200 Subject: [PATCH 09/13] Add description to the following route parameters Pedestrian: Use elevation data: Add "." in the sentences end. --- OsmAnd/res/values/strings.xml | 3 +-- .../plus/settings/bottomsheets/ElevationDateBottomSheet.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index c8c73ec331..69f4c6506e 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,6 +12,7 @@ --> + Routing could avoid strong uphills. Application restart required to apply some settings. On pause Are you sure you want to stop recording?\nAll unsaved data will be lost. @@ -21,7 +22,6 @@ Delete %1$d files? All regions Restart - Routing could avoid strong uphills Don\'t rotate map view if speed is less than a threshold Current location icon will be snapped to the current navigation route Select driving purpose to get shorter, faster or safer route @@ -1624,7 +1624,6 @@ Total distance Select elevation fluctuation Use elevation data - Factor in terrain elevation (via SRTM, ASTER, and EU-DEM data). Show depth contours and points. Nautical depth contours