use of org.edx.mobile.model.api.AnnouncementsModel in project edx-app-android by edx.
the class CourseCombinedInfoFragment method populateAnnouncements.
private void populateAnnouncements(@NonNull List<AnnouncementsModel> announcementsList) {
errorNotification.hideError();
StringBuilder buff = WebViewUtil.getIntialWebviewBuffer(getActivity(), logger);
buff.append("<body>");
for (AnnouncementsModel model : announcementsList) {
buff.append("<div class=\"header\">");
buff.append(model.getDate());
buff.append("</div>");
buff.append("<div class=\"separator\"></div>");
buff.append("<div>");
buff.append(model.getContent());
buff.append("</div>");
}
buff.append("</body>");
announcementWebView.clearCache(true);
announcementWebView.loadDataWithBaseURL(environment.getConfig().getApiHostURL(), buff.toString(), "text/html", StandardCharsets.UTF_8.name(), null);
}
use of org.edx.mobile.model.api.AnnouncementsModel in project edx-app-android by edx.
the class ApiTests method testGetAnnouncement.
// TODO: Debug and fix test failure
@Ignore
@Test
public void testGetAnnouncement() throws Exception {
login();
// get a course id for this test
List<EnrolledCoursesResponse> courses = executeStrict(courseAPI.getEnrolledCourses());
assertTrue("Must have enrolled to at least one course", courses != null && courses.size() > 0);
String updatesUrl = courses.get(0).getCourse().getCourse_updates();
List<AnnouncementsModel> res = executeStrict(new TypeToken<List<AnnouncementsModel>>() {
}, okHttpClient.newCall(new Request.Builder().url(updatesUrl).get().build()));
assertTrue(res != null);
for (AnnouncementsModel r : res) {
print(r.getDate());
}
}
Aggregations