From a2a7cb77bff4589316c25f83739887d9a6811a8b Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 20 Apr 2021 18:01:55 +0300 Subject: [PATCH] Fix gpxItem locationOnMap --- .../net/osmand/plus/monitoring/TripRecordingBottomSheet.java | 4 ++-- .../src/net/osmand/plus/myplaces/SegmentActionsListener.java | 4 +++- .../src/net/osmand/plus/myplaces/TrackSegmentFragment.java | 2 +- OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java index 89734b7415..41cff45f1e 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java @@ -83,7 +83,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl public static final String UPDATE_DYNAMIC_ITEMS = "update_dynamic_items"; private static final int GPS_UPDATE_INTERVAL = 1000; public static final GPXTabItemType[] INIT_TAB_ITEMS = - new GPXTabItemType[]{GPX_TAB_ITEM_GENERAL, GPX_TAB_ITEM_ALTITUDE, GPX_TAB_ITEM_SPEED}; + new GPXTabItemType[] {GPX_TAB_ITEM_GENERAL, GPX_TAB_ITEM_ALTITUDE, GPX_TAB_ITEM_SPEED}; private OsmandApplication app; private OsmandSettings settings; @@ -651,7 +651,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl } @Override - public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { + public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) { } public interface DismissTargetFragment { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java b/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java index 3851e7e102..586b22634d 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java @@ -2,6 +2,8 @@ package net.osmand.plus.myplaces; import android.view.View; +import androidx.annotation.NonNull; + import net.osmand.GPXUtilities.TrkSegment; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; @@ -19,5 +21,5 @@ public interface SegmentActionsListener { void showOptionsPopupMenu(View view, TrkSegment trkSegment, boolean confirmDeletion, GpxDisplayItem gpxItem); - void openAnalyzeOnMap(GpxDisplayItem gpxItem); + void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem); } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index c95d511526..9352cfc0a2 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -292,7 +292,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit } @Override - public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { + public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) { OsmandSettings settings = app.getSettings(); settings.setMapLocationToShow(gpxItem.locationOnMap.lat, gpxItem.locationOnMap.lon, settings.getLastKnownMapZoom(), diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 2eedf2eab5..086ffcce4f 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -1131,7 +1131,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } @Override - public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { + public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) { + if (gpxPoint != null) { + gpxItem.locationOnMap = gpxPoint.getSelectedPoint(); + } TrackDetailsMenu trackDetailsMenu = getMapActivity().getTrackDetailsMenu(); trackDetailsMenu.setGpxItem(gpxItem); trackDetailsMenu.setSelectedGpxFile(selectedGpxFile);