Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-01 08:36:32 +01:00
commit fc633fcd3d
3 changed files with 33 additions and 1 deletions

View file

@ -274,7 +274,11 @@ public class MapContextMenu extends MenuTitleController {
}
public void buttonSharePressed() {
ShareMenu.show(latLon, nameStr, mapActivity);
if (menuController != null) {
menuController.share(latLon, nameStr);
} else {
ShareMenu.show(latLon, nameStr, mapActivity);
}
}
public void buttonMorePressed() {

View file

@ -23,6 +23,7 @@ import net.osmand.plus.mapcontextmenu.controllers.ParkingPositionMenuController;
import net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController;
import net.osmand.plus.mapcontextmenu.controllers.AudioVideoNoteMenuController;
import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController;
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.osmedit.OsmPoint;
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
@ -217,4 +218,8 @@ public abstract class MenuController extends BaseMenuController {
public String getTypeStr() { return ""; }
public String getNameStr() { return ""; }
public void share(LatLon latLon, String title) {
ShareMenu.show(latLon, title, getMapActivity());
}
}

View file

@ -1,7 +1,10 @@
package net.osmand.plus.mapcontextmenu.controllers;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
@ -76,4 +79,24 @@ public class AudioVideoNoteMenuController extends MenuController {
public boolean needStreetName() {
return false;
}
@Override
public void share(LatLon latLon, String title) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
if (recording.isPhoto()) {
Uri screenshotUri = Uri.parse(recording.getFile().getAbsolutePath());
sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
} else if (recording.isAudio()) {
Uri audioUri = Uri.parse(recording.getFile().getAbsolutePath());
sharingIntent.setType("audio/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, audioUri);
} else if (recording.isVideo()) {
Uri videoUri = Uri.parse(recording.getFile().getAbsolutePath());
sharingIntent.setType("video/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, videoUri);
}
getMapActivity().getContextMenu().findMenuFragment()
.startActivity(Intent.createChooser(sharingIntent, getMapActivity().getString(R.string.share_note)));
}
}