Search in sources :

Example 1 with Note

use of io.jawg.osmcontributor.model.entities.Note in project osm-contributor by jawg.

the class MapFragmentPresenter method impacteLoadedNotes.

private void impacteLoadedNotes(List<Note> notes) {
    List<MapElement> mapElements = new ArrayList<>(notes.size());
    for (Note note : notes) {
        mapElements.add(note);
    }
    onLoaded(mapElements, LocationMarkerView.MarkerType.NOTE);
}
Also used : MapElement(io.jawg.osmcontributor.utils.core.MapElement) Note(io.jawg.osmcontributor.model.entities.Note) ArrayList(java.util.ArrayList)

Example 2 with Note

use of io.jawg.osmcontributor.model.entities.Note in project osm-contributor by jawg.

the class MapFragmentPresenter method setIcon.

private void setIcon(LocationMarkerViewOptions markerOptions, Object relatedObject, boolean selected) {
    Bitmap bitmap;
    if (relatedObject instanceof Poi) {
        Poi poi = (Poi) relatedObject;
        bitmap = mapFragment.getBitmapHandler().getMarkerBitmap(poi.getType(), Poi.computeState(selected, false, poi.getUpdated()));
    } else {
        Note note = (Note) relatedObject;
        bitmap = mapFragment.getBitmapHandler().getNoteBitmap(Note.computeState(note, selected, false));
    }
    if (bitmap != null) {
        markerOptions.icon(IconFactory.getInstance(mapFragment.getActivity()).fromBitmap(bitmap));
    }
}
Also used : Bitmap(android.graphics.Bitmap) Note(io.jawg.osmcontributor.model.entities.Note) Poi(io.jawg.osmcontributor.model.entities.Poi)

Example 3 with Note

use of io.jawg.osmcontributor.model.entities.Note in project osm-contributor by jawg.

the class SyncManager method onSyncDownloadPoisAndNotesEvent.

// ********************************
// ************ Events ************
// ********************************
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onSyncDownloadPoisAndNotesEvent(SyncDownloadPoisAndNotesEvent event) {
    syncDownloadPoiBox(event.getBox());
    List<Note> notes = syncNoteManager.syncDownloadNotesInBox(event.getBox());
    if (notes != null && notes.size() > 0) {
        noteManager.mergeBackendNotes(notes);
    }
    bus.post(new PoisAndNotesDownloadedEvent());
}
Also used : Note(io.jawg.osmcontributor.model.entities.Note) PoisAndNotesDownloadedEvent(io.jawg.osmcontributor.model.events.PoisAndNotesDownloadedEvent) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 4 with Note

use of io.jawg.osmcontributor.model.entities.Note in project osm-contributor by jawg.

the class MapFragment method displayNoteDetailBanner.

/*-----------------------------------------------------------
    * NOTE DETAIL
    *---------------------------------------------------------*/
private void displayNoteDetailBanner(boolean display) {
    if (display) {
        if (markerSelected != null && !markerSelected.getType().equals(LocationMarkerView.MarkerType.POI)) {
            eventBus.post(new PleaseChangeValuesDetailNoteFragmentEvent((Note) markerSelected.getRelatedObject()));
        }
        if (noteDetailWrapper.getVisibility() != View.VISIBLE) {
            Animation bottomUp = AnimationUtils.loadAnimation(getActivity(), R.anim.anim_up_detail);
            noteDetailWrapper.startAnimation(bottomUp);
            noteDetailWrapper.setVisibility(View.VISIBLE);
        }
    } else {
        if (noteDetailWrapper.getVisibility() == View.VISIBLE) {
            Animation bottomUp = AnimationUtils.loadAnimation(getActivity(), R.anim.anim_down_detail);
            noteDetailWrapper.startAnimation(bottomUp);
            noteDetailWrapper.setVisibility(View.GONE);
        }
    }
}
Also used : Note(io.jawg.osmcontributor.model.entities.Note) Animation(android.view.animation.Animation) PleaseChangeValuesDetailNoteFragmentEvent(io.jawg.osmcontributor.ui.events.map.PleaseChangeValuesDetailNoteFragmentEvent)

Example 5 with Note

use of io.jawg.osmcontributor.model.entities.Note in project osm-contributor by jawg.

the class NoteManager method queryForId.

/**
 * Query for a Note with a given id eagerly.
 *
 * @param id The id of the Note to load.
 * @return The queried Note.
 */
public Note queryForId(Long id) {
    Note note = noteDao.queryForId(id);
    if (note == null) {
        return null;
    }
    note.setComments(loadLazyForeignCollection(note.getComments()));
    return note;
}
Also used : SyncFinishUploadNote(io.jawg.osmcontributor.rest.events.SyncFinishUploadNote) Note(io.jawg.osmcontributor.model.entities.Note)

Aggregations

Note (io.jawg.osmcontributor.model.entities.Note)15 ArrayList (java.util.ArrayList)5 Comment (io.jawg.osmcontributor.model.entities.Comment)4 SyncFinishUploadNote (io.jawg.osmcontributor.rest.events.SyncFinishUploadNote)4 DateTime (org.joda.time.DateTime)3 Poi (io.jawg.osmcontributor.model.entities.Poi)2 NoteDto (io.jawg.osmcontributor.rest.dtos.osm.NoteDto)2 PleaseChangeValuesDetailNoteFragmentEvent (io.jawg.osmcontributor.ui.events.map.PleaseChangeValuesDetailNoteFragmentEvent)2 NoteManager (io.jawg.osmcontributor.ui.managers.NoteManager)2 MapElement (io.jawg.osmcontributor.utils.core.MapElement)2 Subscribe (org.greenrobot.eventbus.Subscribe)2 Test (org.junit.Test)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Bitmap (android.graphics.Bitmap)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 Animation (android.view.animation.Animation)1 EditText (android.widget.EditText)1 PoisAndNotesDownloadedEvent (io.jawg.osmcontributor.model.events.PoisAndNotesDownloadedEvent)1