Merge pull request #703 from Bars107/master

Fixes to route points plugin.
This commit is contained in:
vshcherb 2014-06-19 16:12:29 +02:00
commit 14cc9bd1b4
2 changed files with 9 additions and 4 deletions

View file

@ -77,7 +77,9 @@ public class RoutePointsActivity extends OsmandListActivity {
app.getSelectedGpxHelper().setGpxFileToDisplay(gpx); app.getSelectedGpxHelper().setGpxFileToDisplay(gpx);
plugin.setCurrentRoute(gpx); plugin.setCurrentRoute(gpx);
SelectedRouteGpxFile sgpx = plugin.getCurrentRoute(); SelectedRouteGpxFile sgpx = plugin.getCurrentRoute();
sgpx.naviateToNextPoint(); if (!sgpx.getCurrentPoints().get(0).isNextNavigate){
sgpx.naviateToNextPoint();
}
prepareView(); prepareView();
return false; return false;
} }
@ -265,6 +267,7 @@ public class RoutePointsActivity extends OsmandListActivity {
if (menuItem.getItemId() == MARK_AS_CURRENT_ID) { if (menuItem.getItemId() == MARK_AS_CURRENT_ID) {
plugin.getCurrentRoute().navigateToPoint(rp); plugin.getCurrentRoute().navigateToPoint(rp);
saveGPXAsync(); saveGPXAsync();
prepareView();
} else if (menuItem.getItemId() == POI_ON_MAP_ID) { } else if (menuItem.getItemId() == POI_ON_MAP_ID) {
LatLon point = rp.getPoint(); LatLon point = rp.getPoint();
app.getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), app.getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
@ -274,6 +277,7 @@ public class RoutePointsActivity extends OsmandListActivity {
// inverts selection state of item // inverts selection state of item
plugin.getCurrentRoute().markPoint(rp, !rp.isVisited()); plugin.getCurrentRoute().markPoint(rp, !rp.isVisited());
saveGPXAsync(); saveGPXAsync();
prepareView();
} }
actionMode.finish(); actionMode.finish();
return true; return true;

View file

@ -135,7 +135,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
} }
}); });
routeStepsControl.setText(null, null); routeStepsControl.setText(null, null);
routeStepsControl.setImageDrawable(map.getResources().getDrawable(R.drawable.widget_parking)); routeStepsControl.setImageDrawable(map.getResources().getDrawable(R.drawable.widget_target));
return routeStepsControl; return routeStepsControl;
} }
@ -213,7 +213,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
public int getVisitedCount() { public int getVisitedCount() {
int k = 0; int k = 0;
for(RoutePoint rp : currentPoints) { for(RoutePoint rp : currentPoints) {
if(!rp.isVisited()) { if(rp.isVisited()) {
k++; k++;
} }
} }
@ -300,6 +300,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
WptPt wptPt = rt.points.get(i); WptPt wptPt = rt.points.get(i);
RoutePoint rtp = new RoutePoint(); RoutePoint rtp = new RoutePoint();
rtp.gpxOrder = i; rtp.gpxOrder = i;
rtp.wpt = wptPt;
String time = wptPt.getExtensionsToRead().get(VISITED_KEY); String time = wptPt.getExtensionsToRead().get(VISITED_KEY);
try { try {
rtp.visitedTime = Long.parseLong(time); rtp.visitedTime = Long.parseLong(time);
@ -309,7 +310,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
if(rtp.isNextNavigate) { if(rtp.isNextNavigate) {
locName = null; locName = null;
} }
currentPoints.add(rtp);
} }
sortPoints(); sortPoints();
} }