Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-03-10 01:05:48 +01:00
commit 5e3981fcca
2 changed files with 5 additions and 8 deletions

View file

@ -175,12 +175,12 @@ public class TargetPointsHelper {
}
public void removeWayPoint(boolean updateRoute, int index){
if(index < 0){
if (index < 0) {
settings.clearPointToNavigate();
pointToNavigate = null;
int sz = intermediatePoints.size();
if(sz > 0) {
settings.deleteIntermediatePoint(sz- 1);
if (sz > 0) {
settings.deleteIntermediatePoint(sz - 1);
pointToNavigate = intermediatePoints.remove(sz - 1);
settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
pointToNavigate.pointDescription);
@ -192,9 +192,6 @@ public class TargetPointsHelper {
for(TargetPoint tp : intermediatePoints) {
tp.index = ind++;
}
if(pointToNavigate != null) {
pointToNavigate.index = ind++;
}
}
updateRouteAndReferesh(updateRoute);
}

View file

@ -156,9 +156,9 @@ public class DashWaypointsFragment extends DashLocationFragment {
return true;
}
});
boolean target = model == getMyApplication().getTargetPointsHelper().getPointToNavigate();
if(SHOW_ALL && getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0) {
final List<TargetPoint> allTargets = getMyApplication().getTargetPointsHelper().getIntermediatePointsWithTarget();
boolean target = model == getMyApplication().getTargetPointsHelper().getPointToNavigate();
if (model.index > 0 || target) {
final int ind = target ? allTargets.size() - 1 : model.index;
item = optionsMenu.getMenu().add(R.string.waypoint_visit_before)
@ -195,7 +195,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
getMyApplication().getTargetPointsHelper().removeWayPoint(true, model.index);
getMyApplication().getTargetPointsHelper().removeWayPoint(true, target ? -1 : model.index);
setupTargets();
return true;
}