From 6807052b6aeda8a9fef89deab3f355805b4e0c73 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 23 Sep 2015 12:04:12 +0200 Subject: [PATCH] Clean 3 dots context menu --- .../plus/activities/MapActivityActions.java | 47 ++----------------- 1 file changed, 3 insertions(+), 44 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index ad201deba1..2ec1eb7a23 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -42,6 +42,9 @@ import net.osmand.plus.views.BaseMapLayer; import net.osmand.plus.views.MapTileLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.util.MapUtils; + +import org.apache.commons.logging.Log; + import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -61,8 +64,6 @@ import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; -import org.apache.commons.logging.Log; - public class MapActivityActions implements DialogProvider { private static final Log LOG = PlatformUtil.getLog(MapActivityActions.class); public static final String KEY_LONGITUDE = "longitude"; @@ -329,29 +330,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().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) { - adapter.item(R.string.context_menu_item_directions_to).iconColor( - R.drawable.ic_action_gdirections_dark).reg(); - adapter.item(R.string.context_menu_item_directions_from).iconColor( - R.drawable.ic_action_gdirections_dark).reg(); - } - final TargetPointsHelper targets = getMyApplication().getTargetPointsHelper(); - if(targets.getPointToNavigate() != null) { - adapter.item(R.string.context_menu_item_destination_point).iconColor(R.drawable.ic_action_flag_dark).reg(); - adapter.item(R.string.context_menu_item_intermediate_point).iconColor(R.drawable.ic_action_flage_dark).reg(); - // For button-less search UI - } else { - adapter.item(R.string.context_menu_item_destination_point).iconColor(R.drawable.ic_action_flag_dark).reg(); - } adapter.item(R.string.context_menu_item_search).iconColor(R.drawable.ic_action_search_dark).reg(); - adapter.item(R.string.context_menu_item_share_location).iconColor( - R.drawable.ic_action_gshare_dark).reg(); - adapter.item(R.string.shared_string_add_to_favorites).iconColor( - R.drawable.ic_action_fav_dark).reg(); - - - LOG.debug("contextMenuPoint()"); OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj); getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter); @@ -373,26 +352,6 @@ 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) { - targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, null); - enterRoutePlanningMode(null, null, false); - } else if (standardId == R.string.context_menu_item_directions_from) { - List nms = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectNames(); - enterRoutePlanningMode(new LatLon(latitude, longitude), nms.isEmpty() ? null : nms.get(0), false); - } else if (standardId == R.string.context_menu_item_intermediate_point || - standardId == R.string.context_menu_item_destination_point) { - boolean dest = standardId == R.string.context_menu_item_destination_point; - List nms = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectNames(); - targets.navigateToPoint(new LatLon(latitude, longitude), true, - dest ? -1 : targets.getIntermediatePoints().size(), nms.size() == 0?null : - nms.get(0)); - if(targets.getIntermediatePoints().size() > 0) { - openIntermediatePointsDialog(); - } - } else if (standardId == R.string.context_menu_item_share_location) { - shareLocation(latitude, longitude); - } else if (standardId == R.string.shared_string_add_to_favorites) { - addFavouritePoint(latitude, longitude); } } });