use of de.westnordost.osmapi.notes.NoteComment in project StreetComplete by westnordost.
the class CreateNoteUploadTest method createNote.
private Note createNote(CreateNote fitsTo) {
Note note = new Note();
note.id = 2;
note.status = Note.Status.OPEN;
note.dateCreated = new Date();
note.position = new OsmLatLon(1, 2);
NoteComment comment = new NoteComment();
comment.text = "bla bla";
if (fitsTo != null) {
comment.text += CreateNoteUpload.getAssociatedElementString(fitsTo);
}
comment.action = NoteComment.Action.OPENED;
comment.date = new Date();
note.comments.add(0, comment);
return note;
}
use of de.westnordost.osmapi.notes.NoteComment in project StreetComplete by westnordost.
the class NoteDaoTest method createNote.
static Note createNote() {
Note note = new Note();
note.position = new OsmLatLon(1, 1);
note.status = Note.Status.OPEN;
note.id = 5;
note.dateCreated = new Date(5000);
NoteComment comment = new NoteComment();
comment.text = "hi";
comment.date = new Date(5000);
comment.action = NoteComment.Action.OPENED;
comment.user = new User(5, "PingPong");
note.comments.add(comment);
return note;
}
use of de.westnordost.osmapi.notes.NoteComment in project StreetComplete by westnordost.
the class NoteDiscussionForm method inflateNoteDiscussion.
private void inflateNoteDiscussion(Note note) {
for (NoteComment noteComment : note.comments) {
CharSequence userName;
if (noteComment.isAnonymous()) {
userName = getResources().getString(R.string.quest_noteDiscussion_anonymous);
} else {
userName = noteComment.user.displayName;
}
CharSequence dateDescription = DateUtils.getRelativeTimeSpanString(noteComment.date.getTime(), new Date().getTime(), MINUTE_IN_MILLIS);
CharSequence commenter = String.format(getResources().getString(getNoteCommentActionResourceId(noteComment.action)), userName, dateDescription);
if (noteComment == note.comments.get(0)) {
TextView noteText = getView().findViewById(R.id.noteText);
noteText.setText(noteComment.text);
TextView noteAuthor = getView().findViewById(R.id.noteAuthor);
noteAuthor.setText(commenter);
} else {
ViewGroup discussionItem = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.quest_note_discussion_item, noteDiscussion, false);
TextView commentInfo = discussionItem.findViewById(R.id.comment_info);
commentInfo.setText(commenter);
TextView commentText = discussionItem.findViewById(R.id.comment_text);
commentText.setText(noteComment.text);
noteDiscussion.addView(discussionItem);
}
}
}
use of de.westnordost.osmapi.notes.NoteComment in project StreetComplete by westnordost.
the class OsmNotesDownload method userProbablyCreatedNoteInApp.
private boolean userProbablyCreatedNoteInApp(Long userId, Note note) {
if (userId == null)
return false;
NoteComment firstComment = note.comments.get(0);
boolean isViaApp = firstComment.text.contains("via " + ApplicationConstants.NAME);
return isFromUser(userId, firstComment) && isViaApp;
}
use of de.westnordost.osmapi.notes.NoteComment in project StreetComplete by westnordost.
the class OsmNotesDownloadTest method createANote.
private Note createANote() {
Note note = new Note();
note.id = 4;
note.position = new OsmLatLon(6.0, 7.0);
note.status = Note.Status.OPEN;
note.dateCreated = new Date();
NoteComment comment = new NoteComment();
comment.date = new Date();
comment.action = NoteComment.Action.OPENED;
comment.text = "hurp durp";
note.comments.add(comment);
return note;
}