Source:
public Fragment getItem(int pos) { final CourseComponent unit = getUnit(pos); final CourseComponent minifiedUnit; { if (unit instanceof VideoBlockModel) { minifiedUnit = new VideoBlockModel((VideoBlockModel) unit); } else if (unit instanceof DiscussionBlockModel) { minifiedUnit = new DiscussionBlockModel((DiscussionBlockModel) unit); } else if (unit instanceof HtmlBlockModel) { minifiedUnit = new HtmlBlockModel((HtmlBlockModel) unit); } else minifiedUnit = new CourseComponent(unit); } CourseUnitFragment unitFragment; if (isCourseUnitVideo(minifiedUnit)) { unitFragment = CourseUnitVideoFragment.newInstance((VideoBlockModel) minifiedUnit, (pos < unitList.size()), (pos > 0)); } else if (minifiedUnit instanceof VideoBlockModel && ((VideoBlockModel) minifiedUnit).getData().encodedVideos.getYoutubeVideoInfo() != null) { unitFragment = CourseUnitOnlyOnYoutubeFragment.newInstance(minifiedUnit); } else if (config.isDiscussionsEnabled() && minifiedUnit instanceof DiscussionBlockModel) { unitFragment = CourseUnitDiscussionFragment.newInstance(minifiedUnit, courseData); } else if (!minifiedUnit.isMultiDevice()) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } else if (minifiedUnit.getType() != BlockType.VIDEO && minifiedUnit.getType() != BlockType.HTML && minifiedUnit.getType() != BlockType.OTHERS && minifiedUnit.getType() != BlockType.DISCUSSION && minifiedUnit.getType() != BlockType.PROBLEM) { unitFragment = CourseUnitEmptyFragment.newInstance(minifiedUnit); } else if (minifiedUnit.getAuthorizationDenialReason() == AuthorizationDenialReason.FEATURE_BASED_ENROLLMENTS) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } else if (minifiedUnit instanceof HtmlBlockModel) { unitFragment = CourseUnitWebViewFragment.newInstance((HtmlBlockModel) minifiedUnit); } else { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } unitFragment.setHasComponentCallback(callback); return unitFragment; }

Target:
public Fragment getItem(int pos) { final CourseComponent unit = getUnit(pos); final CourseComponent minifiedUnit; { if (unit instanceof VideoBlockModel) { minifiedUnit = new VideoBlockModel((VideoBlockModel) unit); } else if (unit instanceof DiscussionBlockModel) { minifiedUnit = new DiscussionBlockModel((DiscussionBlockModel) unit); } else if (unit instanceof HtmlBlockModel) { minifiedUnit = new HtmlBlockModel((HtmlBlockModel) unit); } else minifiedUnit = new CourseComponent(unit); } CourseUnitFragment unitFragment; if (minifiedUnit.getAuthorizationDenialReason() == AuthorizationDenialReason.FEATURE_BASED_ENROLLMENTS) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } else if (isCourseUnitVideo(minifiedUnit)) { unitFragment = CourseUnitVideoFragment.newInstance((VideoBlockModel) minifiedUnit, (pos < unitList.size()), (pos > 0)); } else if (minifiedUnit instanceof VideoBlockModel && ((VideoBlockModel) minifiedUnit).getData().encodedVideos.getYoutubeVideoInfo() != null) { unitFragment = CourseUnitOnlyOnYoutubeFragment.newInstance(minifiedUnit); } else if (config.isDiscussionsEnabled() && minifiedUnit instanceof DiscussionBlockModel) { unitFragment = CourseUnitDiscussionFragment.newInstance(minifiedUnit, courseData); } else if (!minifiedUnit.isMultiDevice()) { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } else if (minifiedUnit.getType() != BlockType.VIDEO && minifiedUnit.getType() != BlockType.HTML && minifiedUnit.getType() != BlockType.OTHERS && minifiedUnit.getType() != BlockType.DISCUSSION && minifiedUnit.getType() != BlockType.PROBLEM) { unitFragment = CourseUnitEmptyFragment.newInstance(minifiedUnit); } else if (minifiedUnit instanceof HtmlBlockModel) { unitFragment = CourseUnitWebViewFragment.newInstance((HtmlBlockModel) minifiedUnit); } else { unitFragment = CourseUnitMobileNotSupportedFragment.newInstance(minifiedUnit); } unitFragment.setHasComponentCallback(callback); return unitFragment; }