Merge pull request #4278 from osmandapp/fab_waypoints

Fix adding route point
This commit is contained in:
vshcherb 2017-08-08 10:11:22 +02:00 committed by GitHub
commit f38ea5df5d
2 changed files with 14 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.editors; package net.osmand.plus.mapcontextmenu.editors;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -40,4 +41,10 @@ public class RtePtEditorFragment extends WptPtEditorFragment {
.add(R.id.fragmentContainer, fragment, editor.getFragmentTag()) .add(R.id.fragmentContainer, fragment, editor.getFragmentTag())
.addToBackStack(null).commit(); .addToBackStack(null).commit();
} }
@Override
protected void addWpt(GPXUtilities.GPXFile gpx, String description, String name, String category, int color) {
wpt = gpx.addRtePt(wpt.getLatitude(), wpt.getLongitude(),
System.currentTimeMillis(), description, name, category, color);
}
} }

View file

@ -29,7 +29,7 @@ import java.io.File;
public class WptPtEditorFragment extends PointEditorFragment { public class WptPtEditorFragment extends PointEditorFragment {
protected WptPtEditor editor; protected WptPtEditor editor;
private WptPt wpt; protected WptPt wpt;
private SavingTrackHelper savingTrackHelper; private SavingTrackHelper savingTrackHelper;
private GpxSelectionHelper selectedGpxHelper; private GpxSelectionHelper selectedGpxHelper;
@ -181,13 +181,17 @@ public class WptPtEditorFragment extends PointEditorFragment {
selectedGpxHelper.setGpxFileToDisplay(gpx); selectedGpxHelper.setGpxFileToDisplay(gpx);
} }
} else { } else {
wpt = gpx.addWptPt(wpt.getLatitude(), wpt.getLongitude(), addWpt(gpx, description, name, category, color);
System.currentTimeMillis(), description, name, category, color);
new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).execute(); new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).execute();
} }
} }
} }
protected void addWpt(GPXFile gpx, String description, String name, String category, int color) {
wpt = gpx.addWptPt(wpt.getLatitude(), wpt.getLongitude(),
System.currentTimeMillis(), description, name, category, color);
}
private void doUpdateWpt(String name, String category, String description) { private void doUpdateWpt(String name, String category, String description) {
GPXFile gpx = editor.getGpxFile(); GPXFile gpx = editor.getGpxFile();
if (gpx != null) { if (gpx != null) {