Added share my location for sherpafy

This commit is contained in:
Denis 2014-09-02 16:09:48 +03:00
parent 2731ff35d2
commit 0e9040c5f5
2 changed files with 15 additions and 2 deletions

View file

@ -760,7 +760,20 @@ public class MapActivityActions implements DialogProvider {
final OsmandMapTileView mapView = mapActivity.getMapView(); final OsmandMapTileView mapView = mapActivity.getMapView();
final OsmandApplication app = mapActivity.getMyApplication(); final OsmandApplication app = mapActivity.getMyApplication();
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app); 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 // 1. Where am I
optionsMenuHelper.item(R.string.where_am_i). optionsMenuHelper.item(R.string.where_am_i).
icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light) icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light)

View file

@ -525,7 +525,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
R.string.target_points, R.string.target_points,
R.string.get_directions, R.string.get_directions,
R.string.menu_mute_on, R.string.menu_mute_off, 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(); final StageInformation stage = getSelectedStage();
if (stage != null && !isStageVisited(stage.order)) { if (stage != null && !isStageVisited(stage.order)) {
adapter.item(R.string.complete_stage) adapter.item(R.string.complete_stage)