diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 889284758d..b9f311eb2c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -761,22 +761,6 @@ public class MapActivityActions implements DialogProvider { final OsmandApplication app = mapActivity.getMyApplication(); ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app); - if (Version.isSherpafy(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(), R.string.unknown_location, 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) @@ -974,6 +958,7 @@ public class MapActivityActions implements DialogProvider { }).reg(); } } + OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper); optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light ) .listen(new OnContextMenuClick() { @@ -988,6 +973,7 @@ public class MapActivityActions implements DialogProvider { // app.closeApplication(mapActivity); } }).reg(); + getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper); return optionsMenuHelper; } diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java index 7d0953dcde..96c0e5bf93 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.TreeSet; +import android.widget.Toast; import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.Location; @@ -33,6 +34,7 @@ import net.osmand.plus.activities.DownloadIndexActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivityLayers; import net.osmand.plus.activities.SelectedGPXFragment; +import net.osmand.plus.activities.actions.ShareLocation; import net.osmand.plus.api.FileSettingsAPIImpl; import net.osmand.plus.api.SettingsAPI; import net.osmand.plus.download.DownloadActivityType; @@ -538,7 +540,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization { } }).reg(); } - adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light ).position(adapter.length() - 1) + adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light).position(adapter.length() - 1) .listen(new OnContextMenuClick() { @Override public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) { @@ -546,7 +548,21 @@ public class SherpafyCustomization extends OsmAndAppCustomization { // newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mapActivity.startActivity(newIntent); } - }).reg(); + }).reg(); + + //share my location + adapter.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 (app.getLocationProvider().getLastKnownLocation() != null) { + new ShareLocation(mapActivity).run(); + } else { + Toast.makeText(app, R.string.unknown_location, Toast.LENGTH_LONG).show(); + } + } + }).reg(); + }