This commit is contained in:
Alexey Kulish 2017-03-30 15:38:57 +03:00
parent e3c3501342
commit 5758cb049f
4 changed files with 12 additions and 8 deletions

View file

@ -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, "");
}
}
}

View file

@ -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);
}
}

View file

@ -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() {

View file

@ -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();