Fix - Address not found in targets
This commit is contained in:
parent
f1b0b19ea7
commit
4178a232da
3 changed files with 35 additions and 27 deletions
|
@ -116,6 +116,19 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String descr;
|
||||||
|
PointDescription pd = point.getPointDescription(app);
|
||||||
|
if (Algorithms.isEmpty(pd.getName())) {
|
||||||
|
descr = pd.getTypeName();
|
||||||
|
} else {
|
||||||
|
descr = pd.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textShadow != null) {
|
||||||
|
textShadow.setText(descr);
|
||||||
|
}
|
||||||
|
text.setText(descr);
|
||||||
|
|
||||||
String pointDescription = "";
|
String pointDescription = "";
|
||||||
TextView descText = (TextView) localView.findViewById(R.id.waypoint_desc_text);
|
TextView descText = (TextView) localView.findViewById(R.id.waypoint_desc_text);
|
||||||
if (descText != null) {
|
if (descText != null) {
|
||||||
|
@ -137,6 +150,10 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (descr.equals(pointDescription)) {
|
||||||
|
pointDescription = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (dist > 0) {
|
if (dist > 0) {
|
||||||
String dd = OsmAndFormatter.getFormattedDistance(dist, app);
|
String dd = OsmAndFormatter.getFormattedDistance(dist, app);
|
||||||
if (ps.deviationDistance > 0) {
|
if (ps.deviationDistance > 0) {
|
||||||
|
@ -153,23 +170,6 @@ public class WaypointDialogHelper {
|
||||||
if (descText != null) {
|
if (descText != null) {
|
||||||
descText.setText(pointDescription);
|
descText.setText(pointDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
String descr;
|
|
||||||
PointDescription pd = point.getPointDescription(app);
|
|
||||||
if (Algorithms.isEmpty(pd.getName())) {
|
|
||||||
descr = pd.getTypeName();
|
|
||||||
} else {
|
|
||||||
descr = pd.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (textShadow != null) {
|
|
||||||
textShadow.setText(descr);
|
|
||||||
}
|
|
||||||
text.setText(descr);
|
|
||||||
|
|
||||||
// ((Spannable) text.getText()).setSpan(
|
|
||||||
// new ForegroundColorSpan(ctx.getResources().getColor(R.color.color_distance)), 0, distance.length() - 1,
|
|
||||||
// 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Object> getPoints() {
|
private List<Object> getPoints() {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
|
||||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -422,7 +421,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
hide();
|
hide();
|
||||||
final TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
if (targets.getIntermediatePoints().isEmpty()) {
|
if (targets.getIntermediatePoints().isEmpty()) {
|
||||||
targets.navigateToPoint(latLon, true, -1, getPointDescription());
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||||
|
@ -431,7 +430,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
bld.setSingleChoiceItems(new String[]{
|
bld.setSingleChoiceItems(new String[]{
|
||||||
mapActivity.getString(R.string.clear_intermediate_points),
|
mapActivity.getString(R.string.clear_intermediate_points),
|
||||||
mapActivity.getString(R.string.keep_intermediate_points)
|
mapActivity.getString(R.string.keep_intermediate_points)
|
||||||
// mapActivity.getString(R.string.keep_and_add_destination_point)
|
|
||||||
}, 0, new DialogInterface.OnClickListener() {
|
}, 0, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -444,11 +442,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (defaultVls[0] == 0) {
|
if (defaultVls[0] == 0) {
|
||||||
targets.removeAllWayPoints(false);
|
targets.removeAllWayPoints(false);
|
||||||
targets.navigateToPoint(latLon, true, -1, getPointDescription());
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
//targets.navigateToPoint(latLon, true, targets.getIntermediatePoints().size() + 1, getPointDescription());
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
targets.navigateToPoint(latLon, true, -1, getPointDescription());
|
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,7 +465,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
||||||
pointDescription);
|
getPointDescriptionForTarget());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -528,13 +525,17 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PointDescription getPointDescriptionForTarget() {
|
||||||
|
return hasKnownTitle() ? null : pointDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public void addAsLastIntermediate() {
|
public void addAsLastIntermediate() {
|
||||||
callMenuAction(true, new MenuAction() {
|
callMenuAction(true, new MenuAction() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
||||||
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||||
pointDescription);
|
getPointDescriptionForTarget());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -544,7 +545,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
callMenuAction(true, new MenuAction() {
|
callMenuAction(true, new MenuAction() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().setStartPoint(latLon, true, pointDescription);
|
mapActivity.getMyApplication().getTargetPointsHelper().setStartPoint(latLon, true,
|
||||||
|
getPointDescriptionForTarget());
|
||||||
if (openRouteInfoMenu) {
|
if (openRouteInfoMenu) {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
||||||
}
|
}
|
||||||
|
@ -556,7 +558,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
callMenuAction(true, new MenuAction() {
|
callMenuAction(true, new MenuAction() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon, true, -1, pointDescription);
|
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon, true, -1,
|
||||||
|
getPointDescriptionForTarget());
|
||||||
if (openRouteInfoMenu) {
|
if (openRouteInfoMenu) {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,11 @@ public abstract class MenuTitleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasKnownTitle() {
|
||||||
|
String title = getTitleStr();
|
||||||
|
return getMapActivity().getString(R.string.no_address_found).equals(title) || addressNotKnownStr.equals(title);
|
||||||
|
}
|
||||||
|
|
||||||
public int getLeftIconId() {
|
public int getLeftIconId() {
|
||||||
return leftIconId;
|
return leftIconId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue