commit
621a06b2c0
26 changed files with 154 additions and 98 deletions
|
@ -155,7 +155,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.PluginsFragment;
|
import net.osmand.plus.activities.PluginsFragment;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
|
||||||
import net.osmand.plus.itinerary.ItineraryGroup;
|
import net.osmand.plus.itinerary.ItineraryGroup;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
||||||
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
|
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
|
||||||
import net.osmand.plus.openplacereviews.OPRConstants;
|
import net.osmand.plus.openplacereviews.OPRConstants;
|
||||||
import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener;
|
import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener;
|
||||||
|
@ -259,7 +259,7 @@ public class IntentHelper {
|
||||||
String path = intent.getStringExtra(TRACK_FILE_NAME);
|
String path = intent.getStringExtra(TRACK_FILE_NAME);
|
||||||
String name = intent.getStringExtra(RETURN_SCREEN_NAME);
|
String name = intent.getStringExtra(RETURN_SCREEN_NAME);
|
||||||
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
|
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null, name, null);
|
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, name, null);
|
||||||
mapActivity.setIntent(null);
|
mapActivity.setIntent(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,9 +153,11 @@ public class SelectedGpxMenuBuilder extends MenuBuilder {
|
||||||
OsmAndFormatter.getFormattedSpeed((float) selectedPoint.speed, app), 0, null,
|
OsmAndFormatter.getFormattedSpeed((float) selectedPoint.speed, app), 0, null,
|
||||||
false, null, false, 0, false, false, false, null, false);
|
false, null, false, 0, false, false, false, null, false);
|
||||||
}
|
}
|
||||||
buildRow(view, getThemedIcon(R.drawable.ic_action_relative_bearing), null, app.getString(R.string.shared_string_bearing),
|
if (!Float.isNaN(selectedGpxPoint.getBearing())) {
|
||||||
OsmAndFormatter.getFormattedAzimuth(selectedGpxPoint.getBearing(), app), 0, null,
|
buildRow(view, getThemedIcon(R.drawable.ic_action_relative_bearing), null, app.getString(R.string.shared_string_bearing),
|
||||||
false, null, false, 0, false, false, false, null, false);
|
OsmAndFormatter.getFormattedAzimuth(selectedGpxPoint.getBearing(), app), 0, null,
|
||||||
|
false, null, false, 0, false, false, false, null, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildCategoryView(View view, String name) {
|
private void buildCategoryView(View view, String name) {
|
||||||
|
|
|
@ -43,11 +43,8 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
mapContextMenu.close();
|
mapContextMenu.close();
|
||||||
WptPt wptPt = selectedGpxPoint.selectedPoint;
|
|
||||||
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
|
||||||
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
||||||
String path = selectedGpxFile.getGpxFile().path;
|
TrackMenuFragment.showInstance(mapActivity, selectedGpxFile, selectedGpxPoint, null, null, false);
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon, null, null);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
||||||
|
@ -215,11 +212,15 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
|
|
||||||
public static class SelectedGpxPoint {
|
public static class SelectedGpxPoint {
|
||||||
|
|
||||||
|
private final WptPt prevPoint;
|
||||||
|
private final WptPt nextPoint;
|
||||||
private final WptPt selectedPoint;
|
private final WptPt selectedPoint;
|
||||||
private final SelectedGpxFile selectedGpxFile;
|
private final SelectedGpxFile selectedGpxFile;
|
||||||
private final float bearing;
|
private final float bearing;
|
||||||
|
|
||||||
public SelectedGpxPoint(SelectedGpxFile selectedGpxFile, WptPt selectedPoint, float bearing) {
|
public SelectedGpxPoint(SelectedGpxFile selectedGpxFile, WptPt selectedPoint, WptPt prevPoint, WptPt nextPoint, float bearing) {
|
||||||
|
this.prevPoint = prevPoint;
|
||||||
|
this.nextPoint = nextPoint;
|
||||||
this.selectedPoint = selectedPoint;
|
this.selectedPoint = selectedPoint;
|
||||||
this.selectedGpxFile = selectedGpxFile;
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
this.bearing = bearing;
|
this.bearing = bearing;
|
||||||
|
@ -236,5 +237,13 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
public float getBearing() {
|
public float getBearing() {
|
||||||
return bearing;
|
return bearing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WptPt getPrevPoint() {
|
||||||
|
return prevPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WptPt getNextPoint() {
|
||||||
|
return nextPoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.PointImageDrawable;
|
import net.osmand.plus.base.PointImageDrawable;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
||||||
import net.osmand.plus.track.TrackMenuFragment;
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
|
@ -49,8 +50,8 @@ public class WptPtMenuController extends MenuController {
|
||||||
GpxSelectionHelper selectionHelper = mapActivity.getMyApplication().getSelectedGpxHelper();
|
GpxSelectionHelper selectionHelper = mapActivity.getMyApplication().getSelectedGpxHelper();
|
||||||
SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt);
|
SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt);
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
String path = selectedGpxFile.getGpxFile().path;
|
SelectedGpxPoint gpxPoint = new SelectedGpxPoint(selectedGpxFile, wpt, null, null, Float.NaN);
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat), null, null);
|
TrackMenuFragment.showInstance(mapActivity, selectedGpxFile, gpxPoint, null, null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
|
@ -43,6 +42,7 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
||||||
|
import net.osmand.plus.myplaces.GPXItemPagerAdapter;
|
||||||
import net.osmand.plus.views.layers.GPXLayer;
|
import net.osmand.plus.views.layers.GPXLayer;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
@ -299,18 +299,7 @@ public class TrackDetailsMenu {
|
||||||
List<ILineDataSet> ds = lineData != null ? lineData.getDataSets() : null;
|
List<ILineDataSet> ds = lineData != null ? lineData.getDataSets() : null;
|
||||||
GpxDisplayItem gpxItem = getGpxItem();
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
if (ds != null && ds.size() > 0 && gpxItem != null) {
|
if (ds != null && ds.size() > 0 && gpxItem != null) {
|
||||||
for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) {
|
this.segment = GPXItemPagerAdapter.getSegmentForAnalysis(gpxItem, gpxItem.analysis);
|
||||||
for (TrkSegment s : t.segments) {
|
|
||||||
if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) {
|
|
||||||
segment = s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (segment != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.segment = segment;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return segment;
|
return segment;
|
||||||
|
@ -755,21 +744,21 @@ public class TrackDetailsMenu {
|
||||||
final List<GPXDataSetType[]> availableTypes = new ArrayList<>();
|
final List<GPXDataSetType[]> availableTypes = new ArrayList<>();
|
||||||
boolean hasSlopeChart = false;
|
boolean hasSlopeChart = false;
|
||||||
if (analysis.hasElevationData) {
|
if (analysis.hasElevationData) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE});
|
availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE});
|
||||||
if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
||||||
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SLOPE});
|
availableTypes.add(new GPXDataSetType[] {GPXDataSetType.SLOPE});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (analysis.hasSpeedData) {
|
if (analysis.hasSpeedData) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SPEED});
|
availableTypes.add(new GPXDataSetType[] {GPXDataSetType.SPEED});
|
||||||
}
|
}
|
||||||
if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
||||||
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE});
|
availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE});
|
||||||
}
|
}
|
||||||
if (analysis.hasElevationData && analysis.hasSpeedData) {
|
if (analysis.hasElevationData && analysis.hasSpeedData) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED});
|
availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GPXDataSetType t : gpxItem.chartTypes) {
|
for (GPXDataSetType t : gpxItem.chartTypes) {
|
||||||
|
|
|
@ -316,7 +316,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -502,7 +502,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return isInMeasurementMode();
|
return isInMeasurementMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
import net.osmand.GPXUtilities.Track;
|
import net.osmand.GPXUtilities.Track;
|
||||||
|
@ -34,7 +33,6 @@ import net.osmand.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -52,7 +50,6 @@ import net.osmand.plus.views.controls.WrapContentHeightViewPager.ViewAtPositionI
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -181,17 +178,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
LineData lineData = chart.getLineData();
|
LineData lineData = chart.getLineData();
|
||||||
List<ILineDataSet> ds = lineData != null ? lineData.getDataSets() : null;
|
List<ILineDataSet> ds = lineData != null ? lineData.getDataSets() : null;
|
||||||
if (ds != null && ds.size() > 0) {
|
if (ds != null && ds.size() > 0) {
|
||||||
for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) {
|
segment = getSegmentForAnalysis(gpxItem, analysis);
|
||||||
for (TrkSegment s : t.segments) {
|
|
||||||
if (s.points.size() > 0 && s.points.get(0).equals(analysis.locationStart)) {
|
|
||||||
segment = s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (segment != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return segment;
|
return segment;
|
||||||
|
@ -741,6 +728,14 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
}
|
}
|
||||||
if (gpxItem.chartHighlightPos != -1) {
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||||
|
} else if (gpxItem.locationOnMap != null) {
|
||||||
|
LineData lineData = chart.getLineData();
|
||||||
|
List<ILineDataSet> ds = lineData != null ? lineData.getDataSets() : null;
|
||||||
|
if (ds != null && ds.size() > 0) {
|
||||||
|
OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0);
|
||||||
|
gpxItem.chartHighlightPos = (float) (gpxItem.locationOnMap.distance / dataSet.getDivX());
|
||||||
|
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chart.highlightValue(null);
|
chart.highlightValue(null);
|
||||||
|
@ -818,18 +813,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
gpxItem.chartTypes[i] = orderedDataSet.getDataSetType();
|
gpxItem.chartTypes[i] = orderedDataSet.getDataSetType();
|
||||||
}
|
}
|
||||||
if (gpxItem.chartHighlightPos != -1) {
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
TrkSegment segment = null;
|
TrkSegment segment = getSegmentForAnalysis(gpxItem, gpxItem.analysis);
|
||||||
for (Track t : gpxItem.group.getGpx().tracks) {
|
|
||||||
for (TrkSegment s : t.segments) {
|
|
||||||
if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) {
|
|
||||||
segment = s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (segment != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (segment != null) {
|
if (segment != null) {
|
||||||
OrderedLineDataSet dataSet = (OrderedLineDataSet) dataSets.get(0);
|
OrderedLineDataSet dataSet = (OrderedLineDataSet) dataSets.get(0);
|
||||||
float distance = gpxItem.chartHighlightPos * dataSet.getDivX();
|
float distance = gpxItem.chartHighlightPos * dataSet.getDivX();
|
||||||
|
@ -849,7 +833,16 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openSplitIntervalScreen() {
|
public static TrkSegment getSegmentForAnalysis(GpxDisplayItem gpxItem, GPXTrackAnalysis analysis) {
|
||||||
actionsListener.openSplitInterval(gpxItem, getTrkSegment());
|
for (Track track : gpxItem.group.getGpx().tracks) {
|
||||||
|
for (TrkSegment segment : track.segments) {
|
||||||
|
int size = segment.points.size();
|
||||||
|
if (size > 0 && segment.points.get(0).equals(analysis.locationStart)
|
||||||
|
&& segment.points.get(size - 1).equals(analysis.locationEnd)) {
|
||||||
|
return segment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,7 +453,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
SearchHistoryHelper.getInstance(app).addNewItemToHistory(gpxInfo);
|
SearchHistoryHelper.getInstance(app).addNewItemToHistory(gpxInfo);
|
||||||
File file = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), gpxInfo.getFileName());
|
File file = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), gpxInfo.getFileName());
|
||||||
String path = file.getAbsolutePath();
|
String path = file.getAbsolutePath();
|
||||||
TrackMenuFragment.showInstance(mapActivity, path, false, null, null, QuickSearchDialogFragment.TAG);
|
TrackMenuFragment.showInstance(mapActivity, path, false, null, QuickSearchDialogFragment.TAG);
|
||||||
dialogFragment.dismiss();
|
dialogFragment.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,14 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||||
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.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
||||||
import net.osmand.plus.myplaces.GPXItemPagerAdapter;
|
import net.osmand.plus.myplaces.GPXItemPagerAdapter;
|
||||||
import net.osmand.plus.myplaces.SegmentActionsListener;
|
import net.osmand.plus.myplaces.SegmentActionsListener;
|
||||||
import net.osmand.plus.myplaces.SegmentGPXAdapter;
|
import net.osmand.plus.myplaces.SegmentGPXAdapter;
|
||||||
|
@ -23,12 +26,14 @@ public class SegmentsCard extends BaseCard {
|
||||||
private TrackDisplayHelper displayHelper;
|
private TrackDisplayHelper displayHelper;
|
||||||
private GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT};
|
private GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT};
|
||||||
private SegmentActionsListener listener;
|
private SegmentActionsListener listener;
|
||||||
|
private SelectedGpxPoint gpxPoint;
|
||||||
|
|
||||||
public SegmentsCard(@NonNull MapActivity mapActivity, @NonNull TrackDisplayHelper displayHelper,
|
public SegmentsCard(@NonNull MapActivity mapActivity, @NonNull TrackDisplayHelper displayHelper,
|
||||||
@NonNull SegmentActionsListener listener) {
|
@Nullable SelectedGpxPoint gpxPoint, @NonNull SegmentActionsListener listener) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.displayHelper = displayHelper;
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
this.displayHelper = displayHelper;
|
||||||
|
this.gpxPoint = gpxPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,6 +47,8 @@ public class SegmentsCard extends BaseCard {
|
||||||
container.removeAllViews();
|
container.removeAllViews();
|
||||||
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
|
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
|
||||||
for (GpxDisplayItem displayItem : items) {
|
for (GpxDisplayItem displayItem : items) {
|
||||||
|
updateLocationOnMap(displayItem);
|
||||||
|
|
||||||
View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, container, listener, nightMode);
|
View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, container, listener, nightMode);
|
||||||
|
|
||||||
WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager);
|
WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager);
|
||||||
|
@ -53,4 +60,16 @@ public class SegmentsCard extends BaseCard {
|
||||||
container.addView(segmentView);
|
container.addView(segmentView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateLocationOnMap(GpxDisplayItem item) {
|
||||||
|
if (gpxPoint != null) {
|
||||||
|
TrkSegment segment = GPXItemPagerAdapter.getSegmentForAnalysis(item, item.analysis);
|
||||||
|
if (segment != null && (segment.points.contains(gpxPoint.getSelectedPoint())
|
||||||
|
|| segment.points.contains(gpxPoint.getPrevPoint())
|
||||||
|
&& segment.points.contains(gpxPoint.getNextPoint()))) {
|
||||||
|
item.locationOnMap = gpxPoint.getSelectedPoint();
|
||||||
|
listener.onPointSelected(segment, item.locationOnMap.lat, item.locationOnMap.lon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -39,6 +39,7 @@ import net.osmand.FileUtils;
|
||||||
import net.osmand.FileUtils.RenameCallback;
|
import net.osmand.FileUtils.RenameCallback;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -66,6 +67,7 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.OpenGpxDetailsTask;
|
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.OpenGpxDetailsTask;
|
||||||
|
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
|
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
||||||
import net.osmand.plus.measurementtool.GpxData;
|
import net.osmand.plus.measurementtool.GpxData;
|
||||||
|
@ -154,6 +156,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
private String gpxTitle;
|
private String gpxTitle;
|
||||||
private String returnScreenName;
|
private String returnScreenName;
|
||||||
private String callingFragmentTag;
|
private String callingFragmentTag;
|
||||||
|
private SelectedGpxPoint gpxPoint;
|
||||||
private TrackChartPoints trackChartPoints;
|
private TrackChartPoints trackChartPoints;
|
||||||
|
|
||||||
private Float heading;
|
private Float heading;
|
||||||
|
@ -165,7 +168,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
private int menuHeaderHeight;
|
private int menuHeaderHeight;
|
||||||
private int toolbarHeightPx;
|
private int toolbarHeightPx;
|
||||||
private boolean mapPositionAdjusted;
|
private boolean adjustMapPosition = true;
|
||||||
|
|
||||||
|
|
||||||
public enum TrackMenuType {
|
public enum TrackMenuType {
|
||||||
|
@ -320,6 +323,14 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
this.callingFragmentTag = callingFragmentTag;
|
this.callingFragmentTag = callingFragmentTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGpxPoint(SelectedGpxPoint point) {
|
||||||
|
this.gpxPoint = point;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdjustMapPosition(boolean adjustMapPosition) {
|
||||||
|
this.adjustMapPosition = adjustMapPosition;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
@ -506,7 +517,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
cardsContainer.addView(segmentsCard.getView());
|
cardsContainer.addView(segmentsCard.getView());
|
||||||
} else {
|
} else {
|
||||||
segmentsCard = new SegmentsCard(mapActivity, displayHelper, this);
|
segmentsCard = new SegmentsCard(mapActivity, displayHelper, gpxPoint, this);
|
||||||
segmentsCard.setListener(this);
|
segmentsCard.setListener(this);
|
||||||
cardsContainer.addView(segmentsCard.build(mapActivity));
|
cardsContainer.addView(segmentsCard.build(mapActivity));
|
||||||
}
|
}
|
||||||
|
@ -596,7 +607,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
boolean backButtonVisible = !Algorithms.isEmpty(returnScreenName) && currentMenuState == MenuState.HALF_SCREEN;
|
boolean backButtonVisible = !Algorithms.isEmpty(returnScreenName) && currentMenuState == MenuState.HALF_SCREEN;
|
||||||
AndroidUiHelper.updateVisibility(backButtonContainer, backButtonVisible);
|
AndroidUiHelper.updateVisibility(backButtonContainer, backButtonVisible);
|
||||||
}
|
}
|
||||||
if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) {
|
if (currentMenuState != MenuState.FULL_SCREEN && (changed || adjustMapPosition)) {
|
||||||
adjustMapPosition(getMenuStatePosY(currentMenuState));
|
adjustMapPosition(getMenuStatePosY(currentMenuState));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -750,7 +761,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatusBarColorId() {
|
public int getStatusBarColorId() {
|
||||||
if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) {
|
if (getView() != null && getViewY() <= getFullScreenTopPosY() || !isPortrait()) {
|
||||||
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -971,7 +982,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
if (r.left != 0 && r.right != 0) {
|
if (r.left != 0 && r.right != 0) {
|
||||||
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
|
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
|
||||||
}
|
}
|
||||||
mapPositionAdjusted = true;
|
adjustMapPosition = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,7 +1269,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
boolean currentRecording = file == null;
|
boolean currentRecording = file == null;
|
||||||
String path = file != null ? file.getAbsolutePath() : null;
|
String path = file != null ? file.getAbsolutePath() : null;
|
||||||
if (context instanceof MapActivity) {
|
if (context instanceof MapActivity) {
|
||||||
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null, null);
|
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null);
|
||||||
} else {
|
} else {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(TRACK_FILE_NAME, path);
|
bundle.putString(TRACK_FILE_NAME, path);
|
||||||
|
@ -1309,7 +1320,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
public static void showInstance(@NonNull MapActivity mapActivity,
|
public static void showInstance(@NonNull MapActivity mapActivity,
|
||||||
@Nullable String path,
|
@Nullable String path,
|
||||||
boolean showCurrentTrack,
|
boolean showCurrentTrack,
|
||||||
@Nullable final LatLon latLon,
|
|
||||||
@Nullable final String returnScreenName,
|
@Nullable final String returnScreenName,
|
||||||
@Nullable final String callingFragmentTag) {
|
@Nullable final String callingFragmentTag) {
|
||||||
final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);
|
final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);
|
||||||
|
@ -1318,7 +1328,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
public boolean processResult(SelectedGpxFile selectedGpxFile) {
|
public boolean processResult(SelectedGpxFile selectedGpxFile) {
|
||||||
MapActivity mapActivity = mapActivityRef.get();
|
MapActivity mapActivity = mapActivityRef.get();
|
||||||
if (mapActivity != null && selectedGpxFile != null) {
|
if (mapActivity != null && selectedGpxFile != null) {
|
||||||
showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName, callingFragmentTag);
|
showInstance(mapActivity, selectedGpxFile, null, returnScreenName, callingFragmentTag, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1327,9 +1337,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity,
|
public static boolean showInstance(@NonNull MapActivity mapActivity,
|
||||||
@NonNull SelectedGpxFile selectedGpxFile,
|
@NonNull SelectedGpxFile selectedGpxFile,
|
||||||
@Nullable LatLon latLon,
|
@Nullable SelectedGpxPoint gpxPoint,
|
||||||
@Nullable String returnScreenName,
|
@Nullable String returnScreenName,
|
||||||
@Nullable String callingFragmentTag) {
|
@Nullable String callingFragmentTag,
|
||||||
|
boolean adjustMapPosition) {
|
||||||
try {
|
try {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
||||||
|
@ -1340,9 +1351,12 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
fragment.setSelectedGpxFile(selectedGpxFile);
|
fragment.setSelectedGpxFile(selectedGpxFile);
|
||||||
fragment.setReturnScreenName(returnScreenName);
|
fragment.setReturnScreenName(returnScreenName);
|
||||||
fragment.setCallingFragmentTag(callingFragmentTag);
|
fragment.setCallingFragmentTag(callingFragmentTag);
|
||||||
|
fragment.setAdjustMapPosition(adjustMapPosition);
|
||||||
|
|
||||||
if (latLon != null) {
|
if (gpxPoint != null) {
|
||||||
fragment.setLatLon(latLon);
|
WptPt wptPt = gpxPoint.getSelectedPoint();
|
||||||
|
fragment.setLatLon(new LatLon(wptPt.lat, wptPt.lon));
|
||||||
|
fragment.setGpxPoint(gpxPoint);
|
||||||
} else {
|
} else {
|
||||||
QuadRect rect = selectedGpxFile.getGpxFile().getRect();
|
QuadRect rect = selectedGpxFile.getGpxFile().getRect();
|
||||||
LatLon latLonRect = new LatLon(rect.centerY(), rect.centerX());
|
LatLon latLonRect = new LatLon(rect.centerY(), rect.centerX());
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
@Override
|
@Override
|
||||||
@RequiresPermission(Manifest.permission.VIBRATE)
|
@RequiresPermission(Manifest.permission.VIBRATE)
|
||||||
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
||||||
if (disableLongPressOnMap()) {
|
if (disableLongPressOnMap(point, tileBox)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pressedContextMarker(tileBox, point.x, point.y)) {
|
if (pressedContextMarker(tileBox, point.x, point.y)) {
|
||||||
|
@ -877,7 +877,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
if (mInChangeMarkerPositionMode || mInGpxDetailsMode || mInAddGpxPointMode ||
|
if (mInChangeMarkerPositionMode || mInGpxDetailsMode || mInAddGpxPointMode ||
|
||||||
activity.getMapRouteInfoMenu().isVisible() || MapRouteInfoMenu.waypointsVisible
|
activity.getMapRouteInfoMenu().isVisible() || MapRouteInfoMenu.waypointsVisible
|
||||||
|| MapRouteInfoMenu.followTrackVisible) {
|
|| MapRouteInfoMenu.followTrackVisible) {
|
||||||
|
@ -886,7 +886,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
|
if (((IContextMenuProvider) lt).disableLongPressOnMap(point, tileBox)) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1101,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
boolean disableSingleTap();
|
boolean disableSingleTap();
|
||||||
|
|
||||||
boolean disableLongPressOnMap();
|
boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox);
|
||||||
|
|
||||||
boolean isObjectClickable(Object o);
|
boolean isObjectClickable(Object o);
|
||||||
|
|
||||||
|
|
|
@ -566,7 +566,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.PointImageDrawable;
|
import net.osmand.plus.base.PointImageDrawable;
|
||||||
|
import net.osmand.plus.itinerary.ItineraryGroup;
|
||||||
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
|
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
import net.osmand.plus.itinerary.ItineraryGroup;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
||||||
import net.osmand.plus.render.OsmandRenderer;
|
import net.osmand.plus.render.OsmandRenderer;
|
||||||
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||||
|
@ -56,6 +56,7 @@ import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.track.GradientScaleType;
|
import net.osmand.plus.track.GradientScaleType;
|
||||||
import net.osmand.plus.track.SaveGpxAsyncTask;
|
import net.osmand.plus.track.SaveGpxAsyncTask;
|
||||||
import net.osmand.plus.track.TrackDrawInfo;
|
import net.osmand.plus.track.TrackDrawInfo;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.Renderable;
|
import net.osmand.plus.views.Renderable;
|
||||||
|
@ -1024,7 +1025,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
|
|
||||||
float bearing = prevPointLocation.bearingTo(nextPointLocation);
|
float bearing = prevPointLocation.bearingTo(nextPointLocation);
|
||||||
|
|
||||||
return new SelectedGpxPoint(selectedGpxFile, projectionPoint, bearing);
|
return new SelectedGpxPoint(selectedGpxFile, projectionPoint, prevPoint, nextPoint, bearing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WptPt createProjectionPoint(WptPt prevPoint, WptPt nextPoint, LatLon latLon) {
|
public static WptPt createProjectionPoint(WptPt prevPoint, WptPt nextPoint, LatLon latLon) {
|
||||||
|
@ -1088,8 +1089,16 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return isInTrackAppearanceMode();
|
if (isInTrackAppearanceMode()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (tileBox.getZoom() >= START_ZOOM) {
|
||||||
|
List<Object> res = new ArrayList<>();
|
||||||
|
getTracksFromPoint(tileBox, point, res);
|
||||||
|
return !Algorithms.isEmpty(res);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1098,8 +1107,14 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runExclusiveAction(Object o, boolean unknownLocation) {
|
public boolean runExclusiveAction(Object object, boolean unknownLocation) {
|
||||||
return false;
|
if (unknownLocation || !(object instanceof SelectedGpxPoint)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MapActivity mapActivity = (MapActivity) view.getContext();
|
||||||
|
SelectedGpxPoint point = (SelectedGpxPoint) object;
|
||||||
|
TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), point, null, null, false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1134,6 +1149,20 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
||||||
|
if (tileBox.getZoom() >= START_ZOOM) {
|
||||||
|
List<Object> trackPoints = new ArrayList<>();
|
||||||
|
getTracksFromPoint(tileBox, point, trackPoints);
|
||||||
|
|
||||||
|
if (!Algorithms.isEmpty(trackPoints)) {
|
||||||
|
MapActivity mapActivity = (MapActivity) view.getContext();
|
||||||
|
SelectedGpxPoint selectedGpxPoint = (SelectedGpxPoint) trackPoints.get(0);
|
||||||
|
WptPt wptPt = selectedGpxPoint.getSelectedPoint();
|
||||||
|
PointDescription description = getObjectName(selectedGpxPoint);
|
||||||
|
ContextMenuLayer contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
||||||
|
contextMenuLayer.showContextMenu(new LatLon(wptPt.lat, wptPt.lon), description, selectedGpxPoint, this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return inPlanRouteMode;
|
return inPlanRouteMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -379,7 +379,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -802,7 +802,7 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return isInRouteLineAppearanceMode();
|
return isInRouteLineAppearanceMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableLongPressOnMap() {
|
public boolean disableLongPressOnMap(PointF point, RotatedTileBox tileBox) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue