Fix gpxItem locationOnMap

This commit is contained in:
Vitaliy 2021-04-20 18:01:55 +03:00
parent 7525c925ca
commit a2a7cb77bf
4 changed files with 10 additions and 5 deletions

View file

@ -83,7 +83,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
public static final String UPDATE_DYNAMIC_ITEMS = "update_dynamic_items"; public static final String UPDATE_DYNAMIC_ITEMS = "update_dynamic_items";
private static final int GPS_UPDATE_INTERVAL = 1000; private static final int GPS_UPDATE_INTERVAL = 1000;
public static final GPXTabItemType[] INIT_TAB_ITEMS = 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 OsmandApplication app;
private OsmandSettings settings; private OsmandSettings settings;
@ -651,7 +651,7 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl
} }
@Override @Override
public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) {
} }
public interface DismissTargetFragment { public interface DismissTargetFragment {

View file

@ -2,6 +2,8 @@ package net.osmand.plus.myplaces;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
@ -19,5 +21,5 @@ public interface SegmentActionsListener {
void showOptionsPopupMenu(View view, TrkSegment trkSegment, boolean confirmDeletion, GpxDisplayItem gpxItem); void showOptionsPopupMenu(View view, TrkSegment trkSegment, boolean confirmDeletion, GpxDisplayItem gpxItem);
void openAnalyzeOnMap(GpxDisplayItem gpxItem); void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem);
} }

View file

@ -292,7 +292,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
} }
@Override @Override
public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) {
OsmandSettings settings = app.getSettings(); OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(gpxItem.locationOnMap.lat, gpxItem.locationOnMap.lon, settings.setMapLocationToShow(gpxItem.locationOnMap.lat, gpxItem.locationOnMap.lon,
settings.getLastKnownMapZoom(), settings.getLastKnownMapZoom(),

View file

@ -1131,7 +1131,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} }
@Override @Override
public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { public void openAnalyzeOnMap(@NonNull GpxDisplayItem gpxItem) {
if (gpxPoint != null) {
gpxItem.locationOnMap = gpxPoint.getSelectedPoint();
}
TrackDetailsMenu trackDetailsMenu = getMapActivity().getTrackDetailsMenu(); TrackDetailsMenu trackDetailsMenu = getMapActivity().getTrackDetailsMenu();
trackDetailsMenu.setGpxItem(gpxItem); trackDetailsMenu.setGpxItem(gpxItem);
trackDetailsMenu.setSelectedGpxFile(selectedGpxFile); trackDetailsMenu.setSelectedGpxFile(selectedGpxFile);