From 5758cb049f3f9c79a834880724c8097726517c52 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 30 Mar 2017 15:38:57 +0300 Subject: [PATCH] Fix #3364 --- .../plus/audionotes/AudioVideoNoteMenuController.java | 5 ++--- .../src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 4 ++-- .../src/net/osmand/plus/mapcontextmenu/MenuController.java | 4 ++-- .../net/osmand/plus/mapcontextmenu/other/ShareMenu.java | 7 ++++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java index 515c2d4471..78cae550c2 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteMenuController.java @@ -9,7 +9,6 @@ import android.support.v7.app.AlertDialog; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; -import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -161,7 +160,7 @@ public class AudioVideoNoteMenuController extends MenuController { } @Override - public void share(LatLon latLon, String title) { + public void share(LatLon latLon, String title, String address) { if (mIsFileAvailable) { String path = mRecording.getFile().getAbsolutePath(); MediaScannerConnection.scanFile(getMapActivity(), new String[]{path}, @@ -184,7 +183,7 @@ public class AudioVideoNoteMenuController extends MenuController { } }); } else { - super.share(latLon, title); + super.share(latLon, title, ""); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 3efe5b10e3..e15b02f015 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -705,9 +705,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL public void buttonSharePressed() { if (menuController != null) { - menuController.share(latLon, nameStr); + menuController.share(latLon, nameStr, streetStr); } else { - ShareMenu.show(latLon, nameStr, mapActivity); + ShareMenu.show(latLon, nameStr, streetStr, mapActivity); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 83c779a1d1..dd580971cb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -376,8 +376,8 @@ public abstract class MenuController extends BaseMenuController { return pointDescription.getName(); } - public void share(LatLon latLon, String title) { - ShareMenu.show(latLon, title, getMapActivity()); + public void share(LatLon latLon, String title, String address) { + ShareMenu.show(latLon, title, address, getMapActivity()); } public void updateData() { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java index bad7cbe880..099252dba5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java @@ -19,6 +19,7 @@ public class ShareMenu extends BaseMenuController { private LatLon latLon; private String title; + private String address; private static final String KEY_SHARE_MENU_LATLON = "key_share_menu_latlon"; private static final String KEY_SHARE_MENU_POINT_TITLE = "key_share_menu_point_title"; @@ -67,12 +68,13 @@ public class ShareMenu extends BaseMenuController { return title; } - public static void show(LatLon latLon, String title, MapActivity mapActivity) { + public static void show(LatLon latLon, String title, String address, MapActivity mapActivity) { ShareMenu menu = new ShareMenu(mapActivity); menu.latLon = latLon; menu.title = title; + menu.address = address; ShareMenuFragment.showInstance(menu); } @@ -86,6 +88,9 @@ public class ShareMenu extends BaseMenuController { if (!Algorithms.isEmpty(title)) { sb.append(title).append("\n"); } + if (!Algorithms.isEmpty(address) && !address.equals(title)) { + sb.append(address).append("\n"); + } sb.append(getMapActivity().getString(R.string.shared_string_location)).append(": "); sb.append(geoUrl).append("\n").append(httpUrl); String sms = sb.toString();