use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionAttachmentTest method shouldShowToUser_locked_unlockDatePassed.
@Test
public void shouldShowToUser_locked_unlockDatePassed() {
Date lockDate = new Date(System.currentTimeMillis() - MILLIS_PER_DAY);
DiscussionAttachment attachment = new DiscussionAttachment();
attachment.setUnlockAt(APIHelper.dateToString(lockDate));
attachment.setLocked(true);
assertEquals(true, attachment.shouldShowToUser());
}
use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionEntryHTMLHelper method getContentHTML.
private static String getContentHTML(DiscussionEntry discussionEntry, String message) {
if (message == null || message.equals("null")) {
return "";
} else {
StringBuilder html = new StringBuilder();
html.append("<div class=\"width\">");
html.append(message);
for (RemoteFile attachment : discussionEntry.getAttachments()) {
if (!attachment.isHiddenForUser() && !discussionEntry.isDeleted()) {
html.append("<div class=\"nowrap\">");
html.append(String.format("<img class=\"attachment_img\" src=\"" + ATTACHMENT_ICON + "\" /> <a class=\"attachment_link\" href=\"%s\">%s</a>", attachment.getUrl(), attachment.getDisplayName()));
html.append("</div>");
}
}
html.append("</div>");
return html.toString();
}
}
Aggregations