Search in sources :

Example 1 with Recording

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;
}
Also used : WptPt(net.osmand.plus.GPXUtilities.WptPt) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) File(java.io.File)

Example 2 with Recording

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;
}
Also used : Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) LinkedList(java.util.LinkedList)

Example 3 with Recording

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)));
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) Uri(android.net.Uri) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) File(java.io.File)

Example 4 with Recording

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;
}
Also used : NotesSortByMode(net.osmand.plus.OsmandSettings.NotesSortByMode) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) LinkedList(java.util.LinkedList)

Example 5 with Recording

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);
    }
}
Also used : PointF(android.graphics.PointF) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording)

Aggregations

Recording (net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording)9 ArrayList (java.util.ArrayList)3 File (java.io.File)2 LinkedList (java.util.LinkedList)2 LatLon (net.osmand.data.LatLon)2 GPXFile (net.osmand.plus.GPXUtilities.GPXFile)2 WptPt (net.osmand.plus.GPXUtilities.WptPt)2 Intent (android.content.Intent)1 Paint (android.graphics.Paint)1 PointF (android.graphics.PointF)1 Uri (android.net.Uri)1 NonNull (android.support.annotation.NonNull)1 LayoutInflater (android.view.LayoutInflater)1 FrameLayout (android.widget.FrameLayout)1 LinearLayout (android.widget.LinearLayout)1 List (java.util.List)1 RenderedObject (net.osmand.NativeLibrary.RenderedObject)1 AMapPoint (net.osmand.aidl.maplayer.point.AMapPoint)1 RouteDataObject (net.osmand.binary.RouteDataObject)1 Amenity (net.osmand.data.Amenity)1