Search in sources :

Example 6 with Recording

use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.

the class AudioNotesLayer method getRecordingsFromPoint.

public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List<? super Recording> am) {
    int ex = (int) point.x;
    int ey = (int) point.y;
    int compare = getRadiusPoi(tileBox);
    int radius = compare * 3 / 2;
    for (Recording n : plugin.getAllRecordings()) {
        int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude());
        int y = (int) tileBox.getPixYFromLatLon(n.getLatitude(), n.getLongitude());
        if (calculateBelongs(ex, ey, x, y, compare)) {
            compare = radius;
            am.add(n);
        }
    }
}
Also used : Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) Paint(android.graphics.Paint)

Example 7 with Recording

use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.

the class AudioNotesLayer method onPrepareBufferImage.

@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
    if (tileBox.getZoom() >= startZoom) {
        float iconSize = audio.getWidth() * 3 / 2.5f;
        QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
        DataTileManager<Recording> recs = plugin.getRecordings();
        final QuadRect latlon = tileBox.getLatLonBounds();
        List<Recording> objects = recs.getObjects(latlon.top, latlon.left, latlon.bottom, latlon.right);
        List<Recording> fullObjects = new ArrayList<>();
        List<LatLon> fullObjectsLatLon = new ArrayList<>();
        List<LatLon> smallObjectsLatLon = new ArrayList<>();
        for (Recording o : objects) {
            if (o != contextMenuLayer.getMoveableObject()) {
                float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
                float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
                if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
                    canvas.drawBitmap(pointSmall, x - pointSmall.getWidth() / 2, y - pointSmall.getHeight() / 2, paintIcon);
                    smallObjectsLatLon.add(new LatLon(o.getLatitude(), o.getLongitude()));
                } else {
                    fullObjects.add(o);
                    fullObjectsLatLon.add(new LatLon(o.getLatitude(), o.getLongitude()));
                }
            }
        }
        for (Recording o : fullObjects) {
            float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
            float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
            drawRecording(canvas, o, x, y);
        }
        this.fullObjectsLatLon = fullObjectsLatLon;
        this.smallObjectsLatLon = smallObjectsLatLon;
    }
}
Also used : LatLon(net.osmand.data.LatLon) ArrayList(java.util.ArrayList) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) QuadRect(net.osmand.data.QuadRect)

Example 8 with Recording

use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.

the class MenuController method getMenuController.

public static MenuController getMenuController(MapActivity mapActivity, LatLon latLon, PointDescription pointDescription, Object object, MenuType menuType) {
    MenuController menuController = null;
    if (object != null) {
        if (object instanceof Amenity) {
            menuController = new AmenityMenuController(mapActivity, pointDescription, (Amenity) object);
        } else if (object instanceof FavouritePoint) {
            menuController = new FavouritePointMenuController(mapActivity, pointDescription, (FavouritePoint) object);
        } else if (object instanceof SearchHistoryHelper.HistoryEntry) {
            menuController = new HistoryMenuController(mapActivity, pointDescription, (SearchHistoryHelper.HistoryEntry) object);
        } else if (object instanceof TargetPoint) {
            menuController = new TargetPointMenuController(mapActivity, pointDescription, (TargetPoint) object);
        } else if (object instanceof Recording) {
            menuController = new AudioVideoNoteMenuController(mapActivity, pointDescription, (Recording) object);
        } else if (object instanceof OsmPoint) {
            menuController = new EditPOIMenuController(mapActivity, pointDescription, (OsmPoint) object);
        } else if (object instanceof WptPt) {
            menuController = new WptPtMenuController(mapActivity, pointDescription, (WptPt) object);
        } else if (object instanceof DownloadMapObject) {
            menuController = new MapDataMenuController(mapActivity, pointDescription, (DownloadMapObject) object);
        } else if (object instanceof OpenStreetNote) {
            menuController = new OsmBugMenuController(mapActivity, pointDescription, (OpenStreetNote) object);
        } else if (object instanceof GpxDisplayItem) {
            menuController = new GpxItemMenuController(mapActivity, pointDescription, (GpxDisplayItem) object);
        } else if (object instanceof MapMarker) {
            menuController = new MapMarkerMenuController(mapActivity, pointDescription, (MapMarker) object);
        } else if (object instanceof TransportStopRoute) {
            menuController = new TransportRouteController(mapActivity, pointDescription, (TransportStopRoute) object);
        } else if (object instanceof TransportStop) {
            menuController = new TransportStopController(mapActivity, pointDescription, (TransportStop) object);
        } else if (object instanceof AMapPoint) {
            menuController = new AMapPointMenuController(mapActivity, pointDescription, (AMapPoint) object);
        } else if (object instanceof LatLon) {
            if (pointDescription.isParking()) {
                menuController = new ParkingPositionMenuController(mapActivity, pointDescription);
            } else if (pointDescription.isMyLocation()) {
                menuController = new MyLocationMenuController(mapActivity, pointDescription);
            }
        } else if (object instanceof RouteDataObject) {
            menuController = new ImpassibleRoadsMenuController(mapActivity, pointDescription, (RouteDataObject) object);
        } else if (object instanceof RenderedObject) {
            menuController = new RenderedObjectMenuController(mapActivity, pointDescription, (RenderedObject) object);
        } else if (object instanceof MapillaryImage) {
            menuController = new MapillaryMenuController(mapActivity, pointDescription, (MapillaryImage) object);
        }
    }
    if (menuController == null) {
        menuController = new PointDescriptionMenuController(mapActivity, pointDescription);
    }
    menuController.menuType = menuType;
    menuController.setLatLon(latLon);
    menuController.onCreated();
    return menuController;
}
Also used : TargetPointMenuController(net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController) WptPt(net.osmand.plus.GPXUtilities.WptPt) HistoryMenuController(net.osmand.plus.mapcontextmenu.controllers.HistoryMenuController) TransportStopController(net.osmand.plus.mapcontextmenu.controllers.TransportStopController) FavouritePoint(net.osmand.data.FavouritePoint) MapMarker(net.osmand.plus.MapMarkersHelper.MapMarker) MapillaryImage(net.osmand.plus.mapillary.MapillaryImage) ParkingPositionMenuController(net.osmand.plus.parkingpoint.ParkingPositionMenuController) GpxDisplayItem(net.osmand.plus.GpxSelectionHelper.GpxDisplayItem) GpxItemMenuController(net.osmand.plus.mapcontextmenu.controllers.GpxItemMenuController) MapDataMenuController(net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) RenderedObjectMenuController(net.osmand.plus.mapcontextmenu.controllers.RenderedObjectMenuController) ImpassibleRoadsMenuController(net.osmand.plus.mapcontextmenu.controllers.ImpassibleRoadsMenuController) EditPOIMenuController(net.osmand.plus.osmedit.EditPOIMenuController) TransportStopRoute(net.osmand.plus.transport.TransportStopRoute) MapMarkerMenuController(net.osmand.plus.mapcontextmenu.controllers.MapMarkerMenuController) PointDescriptionMenuController(net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController) AMapPointMenuController(net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController) TransportStop(net.osmand.data.TransportStop) Amenity(net.osmand.data.Amenity) FavouritePointMenuController(net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController) AudioVideoNoteMenuController(net.osmand.plus.audionotes.AudioVideoNoteMenuController) OsmBugMenuController(net.osmand.plus.osmedit.OsmBugMenuController) OsmPoint(net.osmand.plus.osmedit.OsmPoint) TransportRouteController(net.osmand.plus.mapcontextmenu.controllers.TransportRouteController) AMapPoint(net.osmand.aidl.maplayer.point.AMapPoint) AmenityMenuController(net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController) DownloadMapObject(net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject) MyLocationMenuController(net.osmand.plus.mapcontextmenu.controllers.MyLocationMenuController) RenderedObjectMenuController(net.osmand.plus.mapcontextmenu.controllers.RenderedObjectMenuController) PointDescriptionMenuController(net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController) MapMarkerMenuController(net.osmand.plus.mapcontextmenu.controllers.MapMarkerMenuController) AMapPointMenuController(net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController) OsmBugMenuController(net.osmand.plus.osmedit.OsmBugMenuController) WptPtMenuController(net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController) MapillaryMenuController(net.osmand.plus.mapillary.MapillaryMenuController) GpxItemMenuController(net.osmand.plus.mapcontextmenu.controllers.GpxItemMenuController) HistoryMenuController(net.osmand.plus.mapcontextmenu.controllers.HistoryMenuController) ParkingPositionMenuController(net.osmand.plus.parkingpoint.ParkingPositionMenuController) MapDataMenuController(net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController) TargetPointMenuController(net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController) AudioVideoNoteMenuController(net.osmand.plus.audionotes.AudioVideoNoteMenuController) AmenityMenuController(net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController) ImpassibleRoadsMenuController(net.osmand.plus.mapcontextmenu.controllers.ImpassibleRoadsMenuController) EditPOIMenuController(net.osmand.plus.osmedit.EditPOIMenuController) FavouritePointMenuController(net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController) MyLocationMenuController(net.osmand.plus.mapcontextmenu.controllers.MyLocationMenuController) LatLon(net.osmand.data.LatLon) RenderedObject(net.osmand.NativeLibrary.RenderedObject) OpenStreetNote(net.osmand.plus.osmedit.OsmBugsLayer.OpenStreetNote) RouteDataObject(net.osmand.binary.RouteDataObject) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) WptPtMenuController(net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController) MapillaryMenuController(net.osmand.plus.mapillary.MapillaryMenuController)

Example 9 with Recording

use of net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording in project Osmand by osmandapp.

the class NotesAdapter method getView.

@NonNull
@Override
public View getView(final int position, View row, @NonNull ViewGroup parent) {
    if (portrait) {
        final int type = getItemViewType(position);
        boolean header = type == TYPE_DATE_HEADER || type == TYPE_AUDIO_HEADER || type == TYPE_PHOTO_HEADER || type == TYPE_VIDEO_HEADER;
        if (row == null) {
            LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            if (header) {
                row = inflater.inflate(R.layout.list_item_header, parent, false);
                HeaderViewHolder hHolder = new HeaderViewHolder(row);
                row.setTag(hHolder);
            } else {
                row = inflater.inflate(R.layout.note_list_item, parent, false);
                ItemViewHolder iHolder = new ItemViewHolder(row);
                row.setTag(iHolder);
            }
        }
        if (header) {
            setupHeader(type, (HeaderViewHolder) row.getTag());
        } else {
            final Object item = getItem(position);
            if (item instanceof Recording) {
                setupItem(position, (Recording) item, (ItemViewHolder) row.getTag());
            }
        }
        return row;
    } else {
        LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        boolean lastCard = getCardsCount() == position + 1;
        int margin = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
        int sideMargin = app.getResources().getDisplayMetrics().widthPixels / 10;
        FrameLayout fl = new FrameLayout(getContext());
        LinearLayout ll = new LinearLayout(getContext());
        fl.addView(ll);
        ll.setOrientation(LinearLayout.VERTICAL);
        ll.setBackgroundResource(app.getSettings().isLightContent() ? R.drawable.bg_card_light : R.drawable.bg_card_dark);
        ((FrameLayout.LayoutParams) ll.getLayoutParams()).setMargins(sideMargin, margin, sideMargin, lastCard ? margin : 0);
        if (position == 0 && hasShareLocationItem()) {
            createItem(parent, inflater, ll, 0, NotesFragment.SHARE_LOCATION_FILE);
            return fl;
        }
        int headerInd = getHeaderIndex(hasShareLocationItem() ? position - 1 : position);
        HeaderViewHolder headerVH = new HeaderViewHolder(inflater.inflate(R.layout.list_item_header, parent, false));
        setupHeader((int) items.get(headerInd), headerVH);
        ll.addView(headerVH.view);
        for (int i = headerInd + 1; i < items.size(); i++) {
            Object item = items.get(i);
            if (item instanceof Recording) {
                createItem(parent, inflater, ll, i, (Recording) item);
            } else {
                break;
            }
        }
        return fl;
    }
}
Also used : LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) LinearLayout(android.widget.LinearLayout) NonNull(android.support.annotation.NonNull)

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