Search in sources :

Example 21 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry 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();
    }
}
Also used : RemoteFile(com.instructure.canvasapi2.models.RemoteFile)

Aggregations

DiscussionEntry (com.instructure.canvasapi2.models.DiscussionEntry)14 Test (org.junit.Test)14 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)6 RestParams (com.instructure.canvasapi2.builders.RestParams)6 DiscussionTopic (com.instructure.canvasapi2.models.DiscussionTopic)4 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)4 DiscussionEntryHtmlConverter (com.instructure.pandautils.discussions.DiscussionEntryHtmlConverter)2 Assignment (com.instructure.canvasapi2.models.Assignment)1 RemoteFile (com.instructure.canvasapi2.models.RemoteFile)1 ArrayList (java.util.ArrayList)1