Merge pull request #4956 from osmandapp/PaulsBranch
Added ability to share point name (#4777)
This commit is contained in:
commit
0b2d81813a
3 changed files with 16 additions and 0 deletions
|
@ -2857,4 +2857,6 @@
|
||||||
<string name="winter_and_ski_renderer">Winter and ski</string>
|
<string name="winter_and_ski_renderer">Winter and ski</string>
|
||||||
<string name="touring_view_renderer">Touring view (contrast and details)</string>
|
<string name="touring_view_renderer">Touring view (contrast and details)</string>
|
||||||
<string name="nautical_renderer">Nautical</string>
|
<string name="nautical_renderer">Nautical</string>
|
||||||
|
<string name="copy_location_name">Copy Point/POI name</string>
|
||||||
|
<string name="toast_empty_name_error">Location has no name</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -216,5 +216,7 @@ public class ShareDialog {
|
||||||
public static void sendToClipboard(Activity activity, String text) {
|
public static void sendToClipboard(Activity activity, String text) {
|
||||||
ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||||
clipboard.setText(text);
|
clipboard.setText(text);
|
||||||
|
Toast.makeText(activity, R.string.copied_to_clipboard, Toast.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.text.TextUtilsCompat;
|
import android.support.v4.text.TextUtilsCompat;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -30,6 +31,7 @@ public class ShareMenu extends BaseMenuController {
|
||||||
public enum ShareItem {
|
public enum ShareItem {
|
||||||
MESSAGE(R.drawable.ic_action_message, R.string.shared_string_send),
|
MESSAGE(R.drawable.ic_action_message, R.string.shared_string_send),
|
||||||
CLIPBOARD(R.drawable.ic_action_copy, R.string.shared_string_copy),
|
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),
|
GEO(R.drawable.ic_world_globe_dark, R.string.share_geo),
|
||||||
QR_CODE(R.drawable.ic_action_qrcode, R.string.shared_string_qr_code);
|
QR_CODE(R.drawable.ic_action_qrcode, R.string.shared_string_qr_code);
|
||||||
|
|
||||||
|
@ -58,6 +60,7 @@ public class ShareMenu extends BaseMenuController {
|
||||||
List<ShareItem> list = new LinkedList<>();
|
List<ShareItem> list = new LinkedList<>();
|
||||||
list.add(ShareItem.MESSAGE);
|
list.add(ShareItem.MESSAGE);
|
||||||
list.add(ShareItem.CLIPBOARD);
|
list.add(ShareItem.CLIPBOARD);
|
||||||
|
list.add(ShareItem.NAME);
|
||||||
list.add(ShareItem.GEO);
|
list.add(ShareItem.GEO);
|
||||||
list.add(ShareItem.QR_CODE);
|
list.add(ShareItem.QR_CODE);
|
||||||
return list;
|
return list;
|
||||||
|
@ -107,6 +110,15 @@ public class ShareMenu extends BaseMenuController {
|
||||||
case CLIPBOARD:
|
case CLIPBOARD:
|
||||||
ShareDialog.sendToClipboard(getMapActivity(), sms);
|
ShareDialog.sendToClipboard(getMapActivity(), sms);
|
||||||
break;
|
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:
|
case GEO:
|
||||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
|
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
|
||||||
getMapActivity().startActivity(mapIntent);
|
getMapActivity().startActivity(mapIntent);
|
||||||
|
|
Loading…
Reference in a new issue