From 0e9040c5f57d1ae7bbf0b181b1f8fe92c31b448d Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 Sep 2014 16:09:48 +0300 Subject: [PATCH] Added share my location for sherpafy --- .../plus/activities/MapActivityActions.java | 15 ++++++++++++++- .../plus/sherpafy/SherpafyCustomization.java | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index ca52f0aad5..1213b0197c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -760,7 +760,20 @@ public class MapActivityActions implements DialogProvider { final OsmandMapTileView mapView = mapActivity.getMapView(); final OsmandApplication app = mapActivity.getMyApplication(); ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app); - + + //share my location + optionsMenuHelper.item(R.string.context_menu_item_share_location).icons( + R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() { + @Override + public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { + if (getMyApplication().getLocationProvider().getLastKnownLocation() != null) { + new ShareLocation(mapActivity).run(); + } else { + Toast.makeText(getMyApplication(), "Location unknown", Toast.LENGTH_LONG).show(); + } + } + }).reg(); + // 1. Where am I optionsMenuHelper.item(R.string.where_am_i). icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light) diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 39889b8d77..35cd6c4c16 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -525,7 +525,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization { R.string.target_points, R.string.get_directions, R.string.menu_mute_on, R.string.menu_mute_off, - R.string.where_am_i); + R.string.where_am_i, R.string.context_menu_item_share_location); final StageInformation stage = getSelectedStage(); if (stage != null && !isStageVisited(stage.order)) { adapter.item(R.string.complete_stage)