"Set destination" > Favorites, favorite point name should be shown in the "To:" section
This commit is contained in:
parent
a654cd7439
commit
2872df857b
1 changed files with 13 additions and 7 deletions
|
@ -9,6 +9,7 @@ import android.os.Build;
|
||||||
import android.os.Build.VERSION_CODES;
|
import android.os.Build.VERSION_CODES;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.util.Pair;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -285,9 +286,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (selectFromMapTouch) {
|
if (selectFromMapTouch) {
|
||||||
selectFromMapTouch = false;
|
selectFromMapTouch = false;
|
||||||
LatLon latLon = tileBox.getLatLonFromPixel(point.x, point.y);
|
LatLon latLon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||||
LatLon objectLatLon = getObjectLocation(mapActivity.getMapView(), point, tileBox);
|
Pair<LatLon, PointDescription> pair = getObjectLocation(mapActivity.getMapView(), point, tileBox);
|
||||||
LatLon selectedPoint = objectLatLon != null ? objectLatLon : latLon;
|
LatLon selectedPoint = pair != null ? pair.first : latLon;
|
||||||
choosePointTypeAction(mapActivity, selectedPoint, selectFromMapPointType, null, null);
|
PointDescription name = pair != null ? pair.second : null;
|
||||||
|
choosePointTypeAction(mapActivity, selectedPoint, selectFromMapPointType, name, null);
|
||||||
if (selectFromMapWaypoints) {
|
if (selectFromMapWaypoints) {
|
||||||
WaypointsFragment.showInstance(mapActivity.getSupportFragmentManager(), true);
|
WaypointsFragment.showInstance(mapActivity.getSupportFragmentManager(), true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -299,8 +301,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LatLon getObjectLocation(OsmandMapTileView mapView, PointF point, RotatedTileBox tileBox) {
|
private Pair<LatLon, PointDescription> getObjectLocation(OsmandMapTileView mapView, PointF point, RotatedTileBox tileBox) {
|
||||||
LatLon latLon = null;
|
|
||||||
List<Object> objects = new ArrayList<>();
|
List<Object> objects = new ArrayList<>();
|
||||||
for (OsmandMapLayer layer : mapView.getLayers()) {
|
for (OsmandMapLayer layer : mapView.getLayers()) {
|
||||||
if (layer instanceof IContextMenuProvider) {
|
if (layer instanceof IContextMenuProvider) {
|
||||||
|
@ -309,12 +310,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
provider.collectObjectsFromPoint(point, tileBox, objects, true);
|
provider.collectObjectsFromPoint(point, tileBox, objects, true);
|
||||||
for (Object o : objects) {
|
for (Object o : objects) {
|
||||||
if (provider.isObjectClickable(o)) {
|
if (provider.isObjectClickable(o)) {
|
||||||
latLon = provider.getObjectLocation(o);
|
LatLon latLon = provider.getObjectLocation(o);
|
||||||
|
PointDescription name = null;
|
||||||
|
if (o instanceof FavouritePoint) {
|
||||||
|
name = ((FavouritePoint) o).getPointDescription(mapView.getApplication());
|
||||||
|
}
|
||||||
|
return new Pair<>(latLon, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return latLon;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void choosePointTypeAction(MapActivity mapActivity, LatLon latLon, PointType pointType, PointDescription pd, String address) {
|
private void choosePointTypeAction(MapActivity mapActivity, LatLon latLon, PointType pointType, PointDescription pd, String address) {
|
||||||
|
|
Loading…
Reference in a new issue