Search in sources :

Example 11 with VideoBlockModel

use of org.edx.mobile.model.course.VideoBlockModel in project edx-app-android by edx.

the class CourseUnitVideoFragmentTest method getVideoUnit.

/**
 * Method for iterating through the mock course response data, and
 * returning the first video block leaf.
 *
 * @return The first {@link VideoBlockModel} leaf in the mock course data
 */
private VideoBlockModel getVideoUnit() {
    EnrolledCoursesResponse courseData;
    try {
        courseData = executeStrict(courseAPI.getEnrolledCourses()).get(0);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    String courseId = courseData.getCourse().getId();
    CourseStructureV1Model model;
    CourseComponent courseComponent;
    try {
        model = executeStrict(courseAPI.getCourseStructure(courseId));
        courseComponent = (CourseComponent) CourseAPI.normalizeCourseStructure(model, courseId);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return (VideoBlockModel) courseComponent.getVideos().get(0);
}
Also used : EnrolledCoursesResponse(org.edx.mobile.model.api.EnrolledCoursesResponse) CourseStructureV1Model(org.edx.mobile.model.course.CourseStructureV1Model) VideoBlockModel(org.edx.mobile.model.course.VideoBlockModel) CourseComponent(org.edx.mobile.model.course.CourseComponent)

Aggregations

VideoBlockModel (org.edx.mobile.model.course.VideoBlockModel)11 CourseComponent (org.edx.mobile.model.course.CourseComponent)9 DiscussionBlockModel (org.edx.mobile.model.course.DiscussionBlockModel)5 ArrayList (java.util.ArrayList)3 EnrolledCoursesResponse (org.edx.mobile.model.api.EnrolledCoursesResponse)3 HasDownloadEntry (org.edx.mobile.model.course.HasDownloadEntry)3 HtmlBlockModel (org.edx.mobile.model.course.HtmlBlockModel)3 View (android.view.View)2 TextView (android.widget.TextView)2 BlockPath (org.edx.mobile.model.course.BlockPath)2 CourseStructureV1Model (org.edx.mobile.model.course.CourseStructureV1Model)2 VideoData (org.edx.mobile.model.course.VideoData)2 DownloadEntry (org.edx.mobile.model.db.DownloadEntry)2 Test (org.junit.Test)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Fragment (android.support.v4.app.Fragment)1 FragmentManager (android.support.v4.app.FragmentManager)1 ImageView (android.widget.ImageView)1 Gson (com.google.gson.Gson)1