Add direction from as extra item / revert fab as 1 action
This commit is contained in:
parent
9ca23587ac
commit
a60e97b18f
2 changed files with 34 additions and 28 deletions
|
@ -1,24 +1,10 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.londatiga.android.ActionItem;
|
||||
import net.londatiga.android.QuickAction;
|
||||
|
@ -58,11 +44,25 @@ import net.osmand.util.MapUtils;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MapActivityActions implements DialogProvider {
|
||||
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
||||
|
@ -335,6 +335,10 @@ 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;
|
||||
adapter.item(R.string.context_menu_item_search).iconColor(R.drawable.ic_action_search_dark).reg();
|
||||
if (!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||
adapter.item(R.string.context_menu_item_directions_from).iconColor(
|
||||
R.drawable.ic_action_gdirections_dark).reg();
|
||||
}
|
||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||
getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter);
|
||||
|
||||
|
@ -355,6 +359,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
intent.putExtra(SearchActivity.SEARCH_LON, longitude);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(intent);
|
||||
} else if (standardId == R.string.context_menu_item_directions_to) {
|
||||
final TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, null);
|
||||
enterRoutePlanningMode(null, null, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -336,7 +336,6 @@ public class MapContextMenu extends MenuTitleController {
|
|||
|
||||
protected void acquireIcons() {
|
||||
super.acquireIcons();
|
||||
|
||||
if (menuController != null) {
|
||||
favActionIconId = menuController.getFavActionIconId();
|
||||
} else {
|
||||
|
@ -345,10 +344,9 @@ public class MapContextMenu extends MenuTitleController {
|
|||
}
|
||||
|
||||
public void fabPressed() {
|
||||
mapActivity.getMapActions().showNavigationContextMenuPoint(latLon.getLatitude(), latLon.getLongitude());
|
||||
//mapActivity.getMapActions().directionTo(latLon.getLatitude(), latLon.getLongitude());
|
||||
mapActivity.getMapActions().directionTo(latLon.getLatitude(), latLon.getLongitude(), getPointDescription());
|
||||
hide();
|
||||
//mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
}
|
||||
|
||||
public void buttonWaypointPressed() {
|
||||
|
|
Loading…
Reference in a new issue