use of org.edx.mobile.view.CourseUnitFragment in project edx-app-android by edx.
the class CourseUnitPagerAdapter method getItem.
@Override
public Fragment getItem(int pos) {
CourseComponent unit = getUnit(pos);
CourseUnitFragment unitFragment;
// FIXME - for the video, let's ignore studentViewMultiDevice for now
if (isCourseUnitVideo(unit)) {
unitFragment = CourseUnitVideoFragment.newInstance((VideoBlockModel) unit, (pos < unitList.size()), (pos > 0));
} else if (unit instanceof VideoBlockModel && ((VideoBlockModel) unit).getData().encodedVideos.getYoutubeVideoInfo() != null) {
unitFragment = CourseUnitOnlyOnYoutubeFragment.newInstance(unit);
} else if (config.isDiscussionsEnabled() && unit instanceof DiscussionBlockModel) {
unitFragment = CourseUnitDiscussionFragment.newInstance(unit, courseData);
} else if (!unit.isMultiDevice()) {
unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit);
} else if (unit.getType() != BlockType.VIDEO && unit.getType() != BlockType.HTML && unit.getType() != BlockType.OTHERS && unit.getType() != BlockType.DISCUSSION && unit.getType() != BlockType.PROBLEM) {
unitFragment = CourseUnitEmptyFragment.newInstance(unit);
} else if (unit instanceof HtmlBlockModel) {
unitFragment = CourseUnitWebViewFragment.newInstance((HtmlBlockModel) unit);
} else // fallback
{
unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(unit);
}
unitFragment.setHasComponentCallback(callback);
return unitFragment;
}
Aggregations