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;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
import android.app.Activity;
|
import java.io.File;
|
||||||
import android.app.Dialog;
|
import java.text.MessageFormat;
|
||||||
import android.content.DialogInterface;
|
import java.util.ArrayList;
|
||||||
import android.content.Intent;
|
import java.util.Date;
|
||||||
import android.graphics.drawable.Drawable;
|
import java.util.List;
|
||||||
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 net.londatiga.android.ActionItem;
|
import net.londatiga.android.ActionItem;
|
||||||
import net.londatiga.android.QuickAction;
|
import net.londatiga.android.QuickAction;
|
||||||
|
@ -58,11 +44,25 @@ import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import android.app.Activity;
|
||||||
import java.text.MessageFormat;
|
import android.app.Dialog;
|
||||||
import java.util.ArrayList;
|
import android.content.DialogInterface;
|
||||||
import java.util.Date;
|
import android.content.Intent;
|
||||||
import java.util.List;
|
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 {
|
public class MapActivityActions implements DialogProvider {
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class);
|
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) {
|
public void contextMenuPoint(final double latitude, final double longitude, final ContextMenuAdapter iadapter, Object selectedObj) {
|
||||||
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter(mapActivity) : iadapter;
|
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();
|
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);
|
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||||
getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter);
|
getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter);
|
||||||
|
|
||||||
|
@ -355,6 +359,10 @@ public class MapActivityActions implements DialogProvider {
|
||||||
intent.putExtra(SearchActivity.SEARCH_LON, longitude);
|
intent.putExtra(SearchActivity.SEARCH_LON, longitude);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mapActivity.startActivity(intent);
|
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() {
|
protected void acquireIcons() {
|
||||||
super.acquireIcons();
|
super.acquireIcons();
|
||||||
|
|
||||||
if (menuController != null) {
|
if (menuController != null) {
|
||||||
favActionIconId = menuController.getFavActionIconId();
|
favActionIconId = menuController.getFavActionIconId();
|
||||||
} else {
|
} else {
|
||||||
|
@ -345,10 +344,9 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fabPressed() {
|
public void fabPressed() {
|
||||||
mapActivity.getMapActions().showNavigationContextMenuPoint(latLon.getLatitude(), latLon.getLongitude());
|
mapActivity.getMapActions().directionTo(latLon.getLatitude(), latLon.getLongitude(), getPointDescription());
|
||||||
//mapActivity.getMapActions().directionTo(latLon.getLatitude(), latLon.getLongitude());
|
|
||||||
hide();
|
hide();
|
||||||
//mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonWaypointPressed() {
|
public void buttonWaypointPressed() {
|
||||||
|
|
Loading…
Reference in a new issue