Fix #7747 Add "Copy coordinates" into Share dialog.
This commit is contained in:
parent
3217aae9a3
commit
4f33c0d70e
3 changed files with 13 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="copy_coordinates">Copy coordinates</string>
|
||||
<string name="reset_to_default_category_button_promo">Reset to default will reset sort order to the default state after installation.</string>
|
||||
<string name="use_system_screen_timeout">Use system screen timeout</string>
|
||||
<string name="use_system_screen_timeout_promo">Disabled by default, if OsmAnd running on foreground, the screen doesn’t time out.\n\nIf enabled OsmAnd will use system timeout settings.</string>
|
||||
|
|
|
@ -216,7 +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, R.string.copied_to_clipboard, Toast.LENGTH_LONG)
|
||||
Toast.makeText(activity, activity.getString(R.string.copied_to_clipboard) + "\n" + text, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ import android.support.v4.view.ViewCompat;
|
|||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.actions.ShareDialog;
|
||||
|
@ -33,6 +36,7 @@ public class ShareMenu extends BaseMenuController {
|
|||
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),
|
||||
COORDINATES(R.drawable.ic_action_copy, R.string.copy_coordinates),
|
||||
GEO(R.drawable.ic_world_globe_dark, R.string.share_geo),
|
||||
QR_CODE(R.drawable.ic_action_qrcode, R.string.shared_string_qr_code);
|
||||
|
||||
|
@ -62,6 +66,7 @@ public class ShareMenu extends BaseMenuController {
|
|||
list.add(ShareItem.MESSAGE);
|
||||
list.add(ShareItem.CLIPBOARD);
|
||||
list.add(ShareItem.NAME);
|
||||
list.add(ShareItem.COORDINATES);
|
||||
list.add(ShareItem.GEO);
|
||||
list.add(ShareItem.QR_CODE);
|
||||
return list;
|
||||
|
@ -124,6 +129,12 @@ public class ShareMenu extends BaseMenuController {
|
|||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
case COORDINATES:
|
||||
OsmandSettings st = ((OsmandApplication) mapActivity.getApplicationContext()).getSettings();
|
||||
int f = st.COORDINATES_FORMAT.get();
|
||||
ShareDialog.sendToClipboard(mapActivity,
|
||||
OsmAndFormatter.getFormattedCoordinates(latLon.getLatitude(), latLon.getLongitude(), f));
|
||||
break;
|
||||
case GEO:
|
||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUrl));
|
||||
mapActivity.startActivity(mapIntent);
|
||||
|
|
Loading…
Reference in a new issue