add option to copy address;

This commit is contained in:
Skalii 2021-01-05 12:36:02 +02:00
parent 9e209c2186
commit 29edac0125
2 changed files with 12 additions and 0 deletions

View file

@ -12,6 +12,7 @@
-->
<string name="copy_address">Copy address</string>
<string name="routing_attr_allow_intermittent_name">Allow intermittent water ways</string>
<string name="routing_attr_allow_intermittent_description">Allow intermittent water ways</string>
<string name="routing_attr_allow_streams_name">Allow streams and drains</string>

View file

@ -36,6 +36,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),
ADDRESS(R.drawable.ic_action_copy, R.string.copy_address),
NAME(R.drawable.ic_action_copy, R.string.copy_location_name),
COORDINATES(R.drawable.ic_action_copy, R.string.copy_coordinates),
GEO(R.drawable.ic_world_globe_dark, R.string.share_geo),
@ -66,6 +67,7 @@ public class ShareMenu extends BaseMenuController {
List<ShareItem> list = new LinkedList<>();
list.add(ShareItem.MESSAGE);
list.add(ShareItem.CLIPBOARD);
list.add(ShareItem.ADDRESS);
list.add(ShareItem.NAME);
list.add(ShareItem.COORDINATES);
list.add(ShareItem.GEO);
@ -121,6 +123,15 @@ public class ShareMenu extends BaseMenuController {
case CLIPBOARD:
ShareDialog.sendToClipboard(mapActivity, sms);
break;
case ADDRESS:
if (!Algorithms.isEmpty(address)) {
ShareDialog.sendToClipboard(mapActivity, address);
} else {
Toast.makeText(mapActivity,
R.string.no_address_found,
Toast.LENGTH_LONG).show();
}
break;
case NAME:
if (!Algorithms.isEmpty(title)) {
ShareDialog.sendToClipboard(mapActivity, title);