Fix small issues (add option to not replace a target but add as a target)
This commit is contained in:
parent
681f6a27e0
commit
22c65c06c7
3 changed files with 19 additions and 6 deletions
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="keep_and_add_destination_point">Add as destination point</string>
|
||||
<string name="select_gpx">Select GPX …</string>
|
||||
<string name="route_descr_select_destination">Select Destination</string>
|
||||
<string name="route_descr_select_on_map">Select on map …</string>
|
||||
|
@ -406,6 +407,7 @@
|
|||
<string name="context_menu_item_first_intermediate_point">Add as first waypoint</string>
|
||||
<string name="add_as_last_destination_point">Add as last waypoint</string>
|
||||
<string name="add_as_first_destination_point">Add as first waypoint</string>
|
||||
|
||||
<string name="replace_destination_point">Replace destination point</string>
|
||||
<string name="new_destination_point_dialog">You already have destination point set.</string>
|
||||
<string name="target_points">Waypoints</string>
|
||||
|
|
|
@ -230,7 +230,14 @@ public class TargetPointsHelper {
|
|||
|
||||
public void navigateToPoint(LatLon point, boolean updateRoute, int intermediate, String historyName){
|
||||
if(point != null){
|
||||
if(intermediate < 0) {
|
||||
if(intermediate < 0 || intermediate > intermediatePoints.size()) {
|
||||
if(intermediate > intermediatePoints.size()) {
|
||||
LatLon pn = getPointToNavigate();
|
||||
if(pn != null) {
|
||||
settings.insertIntermediatePoint(pn.getLatitude(), pn.getLongitude(), getPointNavigateDescription(),
|
||||
intermediatePoints.size());
|
||||
}
|
||||
}
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), historyName);
|
||||
} else {
|
||||
settings.insertIntermediatePoint(point.getLatitude(), point.getLongitude(), historyName,
|
||||
|
|
|
@ -369,7 +369,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
public void contextMenuPoint(final double latitude, final double longitude, final ContextMenuAdapter iadapter, Object selectedObj) {
|
||||
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter(mapActivity) : iadapter;
|
||||
|
||||
if(!mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||
if(!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||
adapter.item(R.string.context_menu_item_directions_to).icons(
|
||||
R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light).reg();
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
adapter.item(R.string.context_menu_item_destination_point).icons(R.drawable.ic_action_flag_dark,
|
||||
R.drawable.ic_action_flag_light).reg();
|
||||
}
|
||||
if(!mapActivity.getRoutingHelper().isFollowingMode() || mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||
if(!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||
adapter.item(R.string.context_menu_item_directions_from).icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light).reg();
|
||||
}
|
||||
adapter.item(R.string.context_menu_item_search).icons(R.drawable.ic_action_search_dark,
|
||||
|
@ -626,7 +626,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}).reg();
|
||||
}
|
||||
if (getTargets().getPointToNavigate() != null && !routingHelper.isRoutePlanningMode()) {
|
||||
if (getTargets().getPointToNavigate() != null) {
|
||||
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
|
@ -965,16 +965,20 @@ public class MapActivityActions implements DialogProvider {
|
|||
builder.setTitle(R.string.new_destination_point_dialog);
|
||||
builder.setItems(
|
||||
new String[] { act.getString(R.string.replace_destination_point),
|
||||
act.getString(R.string.keep_and_add_destination_point),
|
||||
act.getString(R.string.add_as_first_destination_point), act.getString(R.string.add_as_last_destination_point) },
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 0) {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, -1, name);
|
||||
} else if (which == 1) {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true,
|
||||
targetPointsHelper.getIntermediatePoints().size() + 1, name);
|
||||
} else if (which == 2) {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, targetPointsHelper.getIntermediatePoints().size(), name);
|
||||
} else {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, 0, name);
|
||||
} else {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, targetPointsHelper.getIntermediatePoints().size(), name);
|
||||
}
|
||||
MapActivity.launchMapActivityMoveToTop(act);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue