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);
}
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));
}
}
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());
}
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);
}
}
}
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;
}
Aggregations