introduce new string variable for "set as destination" and make waypoint menu caption case-dependent

This commit is contained in:
sonora 2013-06-09 18:56:53 +02:00
parent 67b4b6baf1
commit e8845a279d
4 changed files with 30 additions and 6 deletions

View file

@ -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="context_menu_item_destination_point">Set as destination</string>
<string name="please_select_address">Select city or street first</string>
<string name="tip_recent_changes_1_4_t">Changes in 1.4:
\n\t* Order waypoints in optimal way to visit all (Travelling salesman, door-to-door)
@ -263,7 +264,7 @@
<string name="target_points">Waypoints</string>
<string name="intermediate_point_too_far">Waypoint %1$s too far from nearest road.</string>
<string name="arrived_at_intermediate_point">You have arrived at your waypoint</string>
<string name="context_menu_item_intermediate_point">Add as destination\nor waypoint</string>
<string name="context_menu_item_intermediate_point">Add as waypoint</string>
<string name="map_widget_intermediate_distance">Waypoint</string>
<string name="ending_point_too_far">Ending point too far from nearest road.</string>
<string name="btn_add_tag">Add Tag</string>

View file

@ -759,6 +759,9 @@ public class MapActivityActions implements DialogProvider {
final TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
if(targets.getPointToNavigate() != null) {
adapter.registerItem(R.string.context_menu_item_intermediate_point, R.drawable.list_activities_set_intermediate);
// For button-less search UI
} else {
adapter.registerItem(R.string.context_menu_item_destination_point, R.drawable.list_activities_set_intermediate);
}
adapter.registerItem(R.string.context_menu_item_show_route, R.drawable.list_activities_show_route_from_here);
adapter.registerItem(R.string.context_menu_item_search, R.drawable.list_activities_search_near_here);
@ -801,6 +804,11 @@ public class MapActivityActions implements DialogProvider {
targets.navigateToPoint(new LatLon(latitude, longitude),
true, targets.getIntermediatePoints().size());
IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity);
// For button-less search UI
} else if (standardId == R.string.context_menu_item_destination_point) {
targets.navigateToPoint(new LatLon(latitude, longitude),
true, targets.getIntermediatePoints().size());
IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity);
} else if (standardId == R.string.context_menu_item_share_location) {
shareLocation(latitude, longitude, mapActivity.getMapView().getZoom());
} else if (standardId == R.string.context_menu_item_add_favorite) {
@ -1245,10 +1253,15 @@ public class MapActivityActions implements DialogProvider {
}
});
qa.addActionItem(setAsDestination);
if (targetPointsHelper.getPointToNavigate() != null) {
//if (targetPointsHelper.getPointToNavigate() != null) {
ActionItem intermediate = new ActionItem();
intermediate.setIcon(activity.getResources().getDrawable(R.drawable.list_activities_set_intermediate));
intermediate.setTitle(activity.getString(R.string.context_menu_item_intermediate_point));
// For button-less search UI
if (targetPointsHelper.getPointToNavigate() != null) {
intermediate.setTitle(activity.getString(R.string.context_menu_item_intermediate_point));
} else {
intermediate.setTitle(activity.getString(R.string.context_menu_item_destination_point));
}
intermediate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -1260,7 +1273,7 @@ public class MapActivityActions implements DialogProvider {
}
});
qa.addActionItem(intermediate);
}
//}
}

View file

@ -69,6 +69,11 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
if (targets.getPointToNavigate() != null) {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point).setShowAsActionFlags(
MenuItem.SHOW_AS_ACTION_ALWAYS);
// For button-less search UI
} else {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point).setShowAsActionFlags(
MenuItem.SHOW_AS_ACTION_ALWAYS);
}
menuItem = menuItem.setIcon(light ? R.drawable.a_9_av_make_available_offline_light
: R.drawable.a_9_av_make_available_offline_dark);
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@ -78,7 +83,7 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
return true;
}
});
}
//}
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.search_shown_on_map).setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(light ? R.drawable.a_7_location_place_light : R.drawable.a_7_location_place_dark);

View file

@ -102,6 +102,11 @@ public class SearchAddressFragment extends SherlockFragment {
if (targets.getPointToNavigate() != null) {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point).setShowAsActionFlags(
MenuItem.SHOW_AS_ACTION_ALWAYS);
// For button-less search UI
} else {
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point).setShowAsActionFlags(
MenuItem.SHOW_AS_ACTION_ALWAYS);
}
menuItem = menuItem.setIcon(light ? R.drawable.a_9_av_make_available_offline_light
: R.drawable.a_9_av_make_available_offline_dark);
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@ -111,7 +116,7 @@ public class SearchAddressFragment extends SherlockFragment {
return true;
}
});
}
//}
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.search_shown_on_map).setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
menuItem = menuItem.setIcon(light ? R.drawable.a_7_location_place_light : R.drawable.a_7_location_place_dark);