Sort from current location
This commit is contained in:
parent
16e4727f1b
commit
0d3238d175
2 changed files with 11 additions and 3 deletions
|
@ -755,7 +755,7 @@
|
||||||
\n\t* Support OSM Notes
|
\n\t* Support OSM Notes
|
||||||
</string>
|
</string>
|
||||||
<string name="search_street_in_neighborhood_cities">Search street in neighborhood cities</string>
|
<string name="search_street_in_neighborhood_cities">Search street in neighborhood cities</string>
|
||||||
<string name="intermediate_items_sort_return">Intermediate waypoints resorted to optimize their order on the way to the destination.</string>
|
<string name="intermediate_items_sort_return">Intermediate waypoints resorted to optimize their order on the way from current location to the destination.</string>
|
||||||
<string name="intermediate_items_sort_by_distance">Sort (door-to-door)</string>
|
<string name="intermediate_items_sort_by_distance">Sort (door-to-door)</string>
|
||||||
<string name="local_osm_changes_backup_successful">OSM change file successfully generated %1$s</string>
|
<string name="local_osm_changes_backup_successful">OSM change file successfully generated %1$s</string>
|
||||||
<string name="local_osm_changes_backup_failed">Backup OSM changes failed</string>
|
<string name="local_osm_changes_backup_failed">Backup OSM changes failed</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.TspAnt;
|
import net.osmand.TspAnt;
|
||||||
import net.osmand.access.AccessibleAlertBuilder;
|
import net.osmand.access.AccessibleAlertBuilder;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -18,6 +19,7 @@ import net.osmand.util.MapUtils;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.app.Application;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnShowListener;
|
import android.content.DialogInterface.OnShowListener;
|
||||||
|
@ -139,11 +141,17 @@ public class IntermediatePointsDialog {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected int[] doInBackground(Void[] params) {
|
protected int[] doInBackground(Void[] params) {
|
||||||
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
|
Location cll = app.getLocationProvider().getLastKnownLocation();
|
||||||
ArrayList<TargetPoint> lt = new ArrayList<TargetPoint>(intermediates);
|
ArrayList<TargetPoint> lt = new ArrayList<TargetPoint>(intermediates);
|
||||||
TargetPoint start ;
|
TargetPoint start ;
|
||||||
if(activity instanceof MapActivity) {
|
|
||||||
LatLon ll = new LatLon(((MapActivity) activity).getMapView().getLatitude(), ((MapActivity) activity).getMapView().getLongitude());
|
if(cll != null) {
|
||||||
|
LatLon ll = new LatLon(cll.getLatitude(), cll.getLongitude());
|
||||||
start = TargetPoint.create(ll, null);
|
start = TargetPoint.create(ll, null);
|
||||||
|
// } else if(activity instanceof MapActivity) {
|
||||||
|
// LatLon ll = new LatLon(((MapActivity) activity).getMapView().getLatitude(), ((MapActivity) activity).getMapView().getLongitude());
|
||||||
|
// start = TargetPoint.create(ll, null);
|
||||||
} else {
|
} else {
|
||||||
start = lt.get(0);
|
start = lt.get(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue