use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.
the class NotesFragment method generateGPXForRecordings.
private File generateGPXForRecordings(Set<Recording> selected) {
File tmpFile = new File(getActivity().getCacheDir(), "share/noteLocations.gpx");
tmpFile.getParentFile().mkdirs();
GPXFile file = new GPXFile();
for (Recording r : getRecordingsForGpx(selected)) {
if (r != SHARE_LOCATION_FILE) {
String desc = r.getDescriptionName(r.getFileName());
if (desc == null) {
desc = r.getFileName();
}
WptPt wpt = new WptPt();
wpt.lat = r.getLatitude();
wpt.lon = r.getLongitude();
wpt.name = desc;
wpt.link = r.getFileName();
wpt.time = r.getFile().lastModified();
wpt.category = r.getSearchHistoryType();
wpt.desc = r.getTypeWithDuration(getContext());
getMyApplication().getSelectedGpxHelper().addPoint(wpt, file);
}
}
GPXUtilities.writeGpxFile(tmpFile, file, getMyApplication());
return tmpFile;
}
use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.
the class NotesFragment method getRecordingsByType.
private List<Recording> getRecordingsByType(int type) {
List<Recording> allRecs = new LinkedList<>(plugin.getAllRecordings());
List<Recording> res = new LinkedList<>();
for (Recording rec : allRecs) {
if (isAppropriate(rec, type)) {
res.add(rec);
}
}
return res;
}
use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.
the class NotesFragment method shareItems.
private void shareItems(Set<Recording> selected) {
ArrayList<Uri> uris = new ArrayList<>();
for (Recording rec : selected) {
File file = rec == SHARE_LOCATION_FILE ? generateGPXForRecordings(selected) : rec.getFile();
if (file != null) {
uris.add(FileProvider.getUriForFile(getContext(), getActivity().getPackageName() + ".fileprovider", file));
}
}
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_STREAM, uris);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (Build.VERSION.SDK_INT > 18) {
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
}
startActivity(Intent.createChooser(intent, getString(R.string.share_note)));
}
use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.
the class NotesFragment method createItemsList.
private List<Object> createItemsList() {
List<Recording> recs = new LinkedList<>(plugin.getAllRecordings());
List<Object> res = new LinkedList<>();
if (!recs.isEmpty()) {
NotesSortByMode sortByMode = getMyApplication().getSettings().NOTES_SORT_BY_MODE.get();
if (sortByMode.isByDate()) {
res.add(NotesAdapter.TYPE_DATE_HEADER);
res.addAll(sortRecsByDateDescending(recs));
} else if (sortByMode.isByType()) {
List<Recording> audios = new LinkedList<>();
List<Recording> photos = new LinkedList<>();
List<Recording> videos = new LinkedList<>();
for (Recording rec : recs) {
if (rec.isAudio()) {
audios.add(rec);
} else if (rec.isPhoto()) {
photos.add(rec);
} else {
videos.add(rec);
}
}
addToResIfNotEmpty(res, audios, NotesAdapter.TYPE_AUDIO_HEADER);
addToResIfNotEmpty(res, photos, NotesAdapter.TYPE_PHOTO_HEADER);
addToResIfNotEmpty(res, videos, NotesAdapter.TYPE_VIDEO_HEADER);
}
}
return res;
}
use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.
the class AudioNotesLayer method onDraw.
@Override
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
if (contextMenuLayer.getMoveableObject() instanceof Recording) {
Recording objectInMotion = (Recording) contextMenuLayer.getMoveableObject();
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
drawRecording(canvas, objectInMotion, pf.x, pf.y);
}
}
Aggregations