Refactored. Added saveCurrentRoute
This commit is contained in:
parent
121b9cd9e9
commit
0f6acbd849
2 changed files with 11 additions and 7 deletions
|
@ -78,17 +78,17 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
if (itemId == R.string.mark_as_not_visited){
|
||||
plugin.getCurrentRoute().markPoint(point,false);
|
||||
plugin.getCurrentRoute().saveGPXAsync();
|
||||
plugin.saveCurrentRoute();
|
||||
} else if (itemId == R.string.mark_as_visited) {
|
||||
plugin.getCurrentRoute().markPoint(point, true);
|
||||
plugin.getCurrentRoute().saveGPXAsync();
|
||||
plugin.saveCurrentRoute();
|
||||
} else if (itemId == R.string.mark_as_current){
|
||||
plugin.getCurrentRoute().markPoint(point, false);
|
||||
plugin.getCurrentRoute().navigateToPoint(point);
|
||||
plugin.getCurrentRoute().saveGPXAsync();
|
||||
plugin.saveCurrentRoute();
|
||||
} else if (itemId == R.string.navigate_to_next){
|
||||
plugin.getCurrentRoute().navigateToNextPoint();
|
||||
plugin.getCurrentRoute().saveGPXAsync();
|
||||
plugin.saveCurrentRoute();
|
||||
}
|
||||
map.refreshMap();
|
||||
}
|
||||
|
|
|
@ -173,6 +173,12 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
public void saveCurrentRoute(){
|
||||
if (currentRoute != null){
|
||||
currentRoute.saveGPXAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private TextInfoWidget createRouteStepsInfoControl(final MapActivity map, Paint paintText, Paint paintSubText) {
|
||||
TextInfoWidget routeStepsControl = new TextInfoWidget(map, 0, paintText, paintSubText) {
|
||||
|
||||
|
@ -479,9 +485,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(RoutePointsPlugin.SelectedRouteGpxFile... params) {
|
||||
if (getCurrentRoute() != null) {
|
||||
getCurrentRoute().saveFile();
|
||||
}
|
||||
saveFile();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue