Search in sources :

Example 1 with RunnableCourseComponent

use of org.edx.mobile.view.common.RunnableCourseComponent in project edx-app-android by edx.

the class ViewPagerDownloadManagerTest method setUp.

@Before
public void setUp() throws Exception {
    // use mockito.answer is a little inconvenience, let's use fake approach
    mainComponentUI = new RunnableCourseComponent() {

        @Override
        public CourseComponent getCourseComponent() {
            return mainComponent;
        }

        @Override
        public void run() {
            ViewPagerDownloadManager.instance.done(this, true);
        }
    };
    prevComponentUI = new RunnableCourseComponent() {

        @Override
        public CourseComponent getCourseComponent() {
            return prevComponent;
        }

        @Override
        public void run() {
            ViewPagerDownloadManager.instance.done(this, true);
        }
    };
    nextComponentUI = new RunnableCourseComponent() {

        @Override
        public CourseComponent getCourseComponent() {
            return nextComponent;
        }

        @Override
        public void run() {
            ViewPagerDownloadManager.instance.done(this, true);
        }
    };
    otherComponentUI = new RunnableCourseComponent() {

        @Override
        public CourseComponent getCourseComponent() {
            return otherComponent;
        }

        @Override
        public void run() {
            ViewPagerDownloadManager.instance.done(this, true);
        }
    };
    ViewPagerDownloadManager.USING_UI_PRELOADING = true;
}
Also used : RunnableCourseComponent(org.edx.mobile.view.common.RunnableCourseComponent) RunnableCourseComponent(org.edx.mobile.view.common.RunnableCourseComponent) CourseComponent(org.edx.mobile.model.course.CourseComponent) Before(org.junit.Before)

Example 2 with RunnableCourseComponent

use of org.edx.mobile.view.common.RunnableCourseComponent in project edx-app-android by edx.

the class ViewPagerDownloadManager method done.

@Override
public synchronized void done(Runnable task, boolean success) {
    RunnableCourseComponent runnableCourseComponent = (RunnableCourseComponent) task;
    if (runnableCourseComponentWeakList.remove(runnableCourseComponent)) {
        taskIsRunning = false;
        tryToRunTask();
    }
}
Also used : RunnableCourseComponent(org.edx.mobile.view.common.RunnableCourseComponent)

Aggregations

RunnableCourseComponent (org.edx.mobile.view.common.RunnableCourseComponent)2 CourseComponent (org.edx.mobile.model.course.CourseComponent)1 Before (org.junit.Before)1