Issue #7646 "Directions from" quick actions
This commit is contained in:
parent
ad1e96471e
commit
112dd1da29
3 changed files with 61 additions and 0 deletions
|
@ -877,6 +877,7 @@
|
|||
<string name="quick_action_replace_destination">Replace destination</string>
|
||||
<string name="quick_action_add_first_intermediate">Add first intermediate</string>
|
||||
<string name="quick_action_add_destination_desc">A button to make the screen center the route destination, any previously selected destination becomes the last intermediate destination.</string>
|
||||
<string name="quick_action_directions_from_desc">A button to make the screen center the point of departure and calculate route to the destination or open a dialog to select destination if the destination marker is not on the map.</string>
|
||||
<string name="quick_action_replace_destination_desc">Tapping this action button makes the screen center the new route destination, replacing the previously selected destination (if any).</string>
|
||||
<string name="quick_action_add_first_intermediate_desc">A button to make the screen center the first intermediate destination.</string>
|
||||
<string name="no_overlay">No overlay</string>
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.plus.quickaction.actions.MarkerAction;
|
|||
import net.osmand.plus.quickaction.actions.NavAddDestinationAction;
|
||||
import net.osmand.plus.quickaction.actions.NavAddFirstIntermediateAction;
|
||||
import net.osmand.plus.quickaction.actions.NavAutoZoomMapAction;
|
||||
import net.osmand.plus.quickaction.actions.NavDirectionsFromAction;
|
||||
import net.osmand.plus.quickaction.actions.NavReplaceDestinationAction;
|
||||
import net.osmand.plus.quickaction.actions.NavResumePauseAction;
|
||||
import net.osmand.plus.quickaction.actions.NavStartStopAction;
|
||||
|
@ -133,6 +134,7 @@ public class QuickActionFactory {
|
|||
|
||||
|
||||
QuickAction voice = new NavVoiceAction();
|
||||
QuickAction directionFrom = new NavDirectionsFromAction();
|
||||
QuickAction addDestination = new NavAddDestinationAction();
|
||||
QuickAction addFirstIntermediate = new NavAddFirstIntermediateAction();
|
||||
QuickAction replaceDestination = new NavReplaceDestinationAction();
|
||||
|
@ -145,6 +147,9 @@ public class QuickActionFactory {
|
|||
if (!voice.hasInstanceInList(active)) {
|
||||
navigationQuickActions.add(voice);
|
||||
}
|
||||
if (!directionFrom.hasInstanceInList(active)) {
|
||||
navigationQuickActions.add(directionFrom);
|
||||
}
|
||||
if (!addDestination.hasInstanceInList(active)) {
|
||||
navigationQuickActions.add(addDestination);
|
||||
}
|
||||
|
@ -230,6 +235,9 @@ public class QuickActionFactory {
|
|||
case MapUnderlayAction.TYPE:
|
||||
return new MapUnderlayAction();
|
||||
|
||||
case NavDirectionsFromAction.TYPE:
|
||||
return new NavDirectionsFromAction();
|
||||
|
||||
case NavAddDestinationAction.TYPE:
|
||||
return new NavAddDestinationAction();
|
||||
|
||||
|
@ -323,6 +331,9 @@ public class QuickActionFactory {
|
|||
case MapUnderlayAction.TYPE:
|
||||
return new MapUnderlayAction(quickAction);
|
||||
|
||||
case NavDirectionsFromAction.TYPE:
|
||||
return new NavDirectionsFromAction(quickAction);
|
||||
|
||||
case NavAddDestinationAction.TYPE:
|
||||
return new NavAddDestinationAction(quickAction);
|
||||
|
||||
|
@ -416,6 +427,9 @@ public class QuickActionFactory {
|
|||
case MapUnderlayAction.TYPE:
|
||||
return R.drawable.ic_layer_bottom_dark;
|
||||
|
||||
case NavDirectionsFromAction.TYPE:
|
||||
return R.drawable.ic_action_route_direction_from_here;
|
||||
|
||||
case NavAddDestinationAction.TYPE:
|
||||
return R.drawable.ic_action_point_add_destination;
|
||||
|
||||
|
@ -512,6 +526,9 @@ public class QuickActionFactory {
|
|||
case DayNightModeAction.TYPE:
|
||||
return R.string.quick_action_day_night_switch_mode;
|
||||
|
||||
case NavDirectionsFromAction.TYPE:
|
||||
return R.string.context_menu_item_directions_from;
|
||||
|
||||
case NavAddDestinationAction.TYPE:
|
||||
return R.string.quick_action_add_destination;
|
||||
|
||||
|
@ -557,6 +574,7 @@ public class QuickActionFactory {
|
|||
case TakePhotoNoteAction.TYPE:
|
||||
case TakeVideoNoteAction.TYPE:
|
||||
case NavVoiceAction.TYPE:
|
||||
case NavDirectionsFromAction.TYPE:
|
||||
case NavAddDestinationAction.TYPE:
|
||||
case NavAddFirstIntermediateAction.TYPE:
|
||||
case NavReplaceDestinationAction.TYPE:
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package net.osmand.plus.quickaction.actions;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
|
||||
public class NavDirectionsFromAction extends QuickAction {
|
||||
|
||||
public static final int TYPE = 19;
|
||||
|
||||
public NavDirectionsFromAction() {
|
||||
super(TYPE);
|
||||
}
|
||||
|
||||
public NavDirectionsFromAction(QuickAction quickAction) {
|
||||
super(quickAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MapActivity activity) {
|
||||
LatLon latLon = activity.getMapView().getCurrentRotatedTileBox().getCenterLatLon();
|
||||
activity.getMapActions().enterDirectionsFromPoint(latLon.getLatitude(), latLon.getLongitude());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawUI(ViewGroup parent, MapActivity activity) {
|
||||
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.quick_action_with_text, parent, false);
|
||||
|
||||
((TextView) view.findViewById(R.id.text)).setText(
|
||||
R.string.quick_action_directions_from_desc);
|
||||
|
||||
parent.addView(view);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue