Fix gpx points screen
This commit is contained in:
parent
89c6a62756
commit
77396ec27c
5 changed files with 49 additions and 5 deletions
|
@ -763,6 +763,16 @@ public class GPXUtilities {
|
|||
return points.remove(pt);
|
||||
}
|
||||
|
||||
public boolean deleteRtePt(WptPt pt) {
|
||||
modifiedTime = System.currentTimeMillis();
|
||||
for (Route route : routes) {
|
||||
if (route.points.remove(pt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<TrkSegment> processRoutePoints() {
|
||||
List<TrkSegment> tpoints = new ArrayList<TrkSegment>();
|
||||
if (routes.size() > 0) {
|
||||
|
|
|
@ -1622,6 +1622,7 @@ public class OsmandSettings {
|
|||
}
|
||||
|
||||
private Object objectToShow;
|
||||
private boolean editObjectToShow;
|
||||
|
||||
public Object getAndClearObjectToShow() {
|
||||
Object objectToShow = this.objectToShow;
|
||||
|
@ -1629,6 +1630,12 @@ public class OsmandSettings {
|
|||
return objectToShow;
|
||||
}
|
||||
|
||||
public boolean getAndClearEditObjectToShow() {
|
||||
boolean res = this.editObjectToShow;
|
||||
this.editObjectToShow = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
public int getMapZoomToShow() {
|
||||
return settingsAPI.getInt(globalPreferences, MAP_ZOOM_TO_SHOW, 5);
|
||||
}
|
||||
|
@ -1651,6 +1658,10 @@ public class OsmandSettings {
|
|||
}
|
||||
}
|
||||
|
||||
public void setEditObjectToShow() {
|
||||
this.editObjectToShow = true;
|
||||
}
|
||||
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom) {
|
||||
setMapLocationToShow(latitude, longitude, zoom, null, false, null);
|
||||
}
|
||||
|
|
|
@ -742,6 +742,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
LatLon latLonToShow = settings.getAndClearMapLocationToShow();
|
||||
PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow(latLonToShow);
|
||||
Object toShow = settings.getAndClearObjectToShow();
|
||||
boolean editToShow = settings.getAndClearEditObjectToShow();
|
||||
int status = settings.isRouteToPointNavigateAndClear();
|
||||
if (status != 0) {
|
||||
// always enable and follow and let calculate it (i.e.GPS is not accessible in a garage)
|
||||
|
@ -786,6 +787,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
} else {
|
||||
mapContextMenu.show(latLonToShow, mapLabelToShow, toShow);
|
||||
}
|
||||
if (editToShow) {
|
||||
mapContextMenu.openEditor();
|
||||
}
|
||||
} else if (!latLonToShow.equals(cur)) {
|
||||
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
||||
latLonToShow.getLongitude(), settings.getMapZoomToShow(), true);
|
||||
|
|
|
@ -739,6 +739,19 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
return dlg;
|
||||
}
|
||||
|
||||
public boolean openEditor() {
|
||||
if (object != null) {
|
||||
if (object instanceof FavouritePoint) {
|
||||
getFavoritePointEditor().edit((FavouritePoint) object);
|
||||
return true;
|
||||
} else if (object instanceof WptPt) {
|
||||
getWptPtPointEditor().edit((WptPt) object);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addAsLastIntermediate() {
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
||||
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||
|
|
|
@ -346,7 +346,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
if (item.getItemId() == DELETE_ACTION_ID) {
|
||||
mode.finish();
|
||||
deleteItemsAction();
|
||||
}
|
||||
return true;
|
||||
|
@ -397,10 +396,14 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
if (gpx.showCurrentTrack) {
|
||||
savingTrackHelper.deletePointData(item.locationStart);
|
||||
} else {
|
||||
gpx.deleteWptPt(item.locationStart);
|
||||
if (item.group.getType() == GpxDisplayItemType.TRACK_POINTS) {
|
||||
gpx.deleteWptPt(item.locationStart);
|
||||
} else if (item.group.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
||||
gpx.deleteRtePt(item.locationStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gpx.showCurrentTrack) {
|
||||
if (!gpx.showCurrentTrack) {
|
||||
GPXUtilities.writeGpxFile(new File(gpx.path), gpx, app);
|
||||
boolean selected = app.getSelectedGpxHelper().getSelectedFileByPath(gpx.path) != null;
|
||||
if (selected) {
|
||||
|
@ -522,7 +525,6 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
if (item.getItemId() == SELECT_FAVORITES_ACTION_MODE_ID) {
|
||||
mode.finish();
|
||||
selectFavoritesImpl();
|
||||
}
|
||||
return true;
|
||||
|
@ -549,6 +551,9 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
FavouritesDbHelper fdb = app.getFavorites();
|
||||
for(GpxDisplayItem i : selectedItems) {
|
||||
if (i.locationStart != null) {
|
||||
|
@ -794,7 +799,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
new PointDescription(PointDescription.POINT_TYPE_WPT, gpxItem.name),
|
||||
false,
|
||||
gpxItem.locationStart);
|
||||
//todo: open edit dialog
|
||||
settings.setEditObjectToShow();
|
||||
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
return true;
|
||||
|
@ -828,6 +833,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
ch.setVisibility(View.VISIBLE);
|
||||
ch.setChecked(selectedItems.contains(gpxItem));
|
||||
row.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||
options.setVisibility(View.GONE);
|
||||
ch.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue