diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 43a84e03c8..e689e51476 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2856,4 +2856,6 @@ Winter and ski Touring view (contrast and details) Nautical + Copy Point/POI name + Location has no name diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java index 300f9641d5..ad2cac6079 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/ShareDialog.java @@ -216,5 +216,7 @@ public class ShareDialog { public static void sendToClipboard(Activity activity, String text) { ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE); clipboard.setText(text); + Toast.makeText(activity, "Copied to clipboard", Toast.LENGTH_LONG) + .show(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java index ae7a4456e1..2de223bee1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java @@ -5,6 +5,7 @@ import android.net.Uri; import android.os.Bundle; import android.support.v4.text.TextUtilsCompat; import android.support.v4.view.ViewCompat; +import android.widget.Toast; import net.osmand.data.LatLon; import net.osmand.plus.R; @@ -30,6 +31,7 @@ public class ShareMenu extends BaseMenuController { public enum ShareItem { MESSAGE(R.drawable.ic_action_message, R.string.shared_string_send), CLIPBOARD(R.drawable.ic_action_copy, R.string.shared_string_copy), + NAME(R.drawable.ic_action_copy, R.string.copy_location_name), GEO(R.drawable.ic_world_globe_dark, R.string.share_geo), QR_CODE(R.drawable.ic_action_qrcode, R.string.shared_string_qr_code); @@ -58,6 +60,7 @@ public class ShareMenu extends BaseMenuController { List list = new LinkedList<>(); list.add(ShareItem.MESSAGE); list.add(ShareItem.CLIPBOARD); + list.add(ShareItem.NAME); list.add(ShareItem.GEO); list.add(ShareItem.QR_CODE); return list; @@ -107,6 +110,15 @@ public class ShareMenu extends BaseMenuController { case CLIPBOARD: ShareDialog.sendToClipboard(getMapActivity(), sms); break; + case NAME: + if (!Algorithms.isEmpty(title)) { + ShareDialog.sendToClipboard(getMapActivity(), title); + } else { + Toast.makeText(getMapActivity(), + R.string.toast_empty_name_error, + Toast.LENGTH_LONG).show(); + } + break; case GEO: Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl)); getMapActivity().startActivity(mapIntent);