use of org.edx.mobile.model.course.CourseComponent in project edx-app-android by edx.
the class CourseUnitWebViewFragment method onResume.
@Override
public void onResume() {
super.onResume();
authWebView.onResume();
if (hasComponentCallback != null) {
final CourseComponent component = hasComponentCallback.getComponent();
if (component != null && component.equals(unit)) {
authWebView.loadUrl(false, unit.getBlockUrl());
}
}
}
use of org.edx.mobile.model.course.CourseComponent in project edx-app-android by edx.
the class CourseVideoListActivity method showLastAccessedView.
@Override
public void showLastAccessedView(final String lastAccessedSubSectionId, final String courseId, final View view) {
if (isActivityStarted()) {
if (NetworkUtil.isConnected(this)) {
if (courseId != null && lastAccessedSubSectionId != null) {
CourseComponent lastAccessComponent = courseManager.getComponentById(courseId, lastAccessedSubSectionId);
if (lastAccessComponent != null) {
if (!lastAccessComponent.isContainer()) {
// getting subsection
if (lastAccessComponent.getParent() != null)
lastAccessComponent = lastAccessComponent.getParent();
// now getting section
if (lastAccessComponent.getParent() != null) {
lastAccessComponent = lastAccessComponent.getParent();
}
}
// to be the course root component itself, then we don't need to show it
if (!lastAccessComponent.getId().equals(courseId)) {
final CourseComponent finalLastAccessComponent = lastAccessComponent;
super.showLastAccessedView(null, lastAccessComponent.getDisplayName(), new View.OnClickListener() {
@Override
public void onClick(View v) {
// This has been used so that if user clicks continuously on the screen,
// two activities should not be opened
long currentTime = SystemClock.elapsedRealtime();
if (currentTime - lastClickTime > 1000) {
lastClickTime = currentTime;
environment.getRouter().showCourseContainerOutline(CourseVideoListActivity.this, courseData, finalLastAccessComponent.getId());
}
}
});
} else {
hideLastAccessedView(view);
}
} else {
hideLastAccessedView(view);
}
}
} else {
hideLastAccessedView(view);
}
}
}
use of org.edx.mobile.model.course.CourseComponent in project edx-app-android by edx.
the class NewCourseOutlineAdapter method getRowView.
public View getRowView(int position, View convertView) {
final SectionRow row = this.getItem(position);
final SectionRow nextRow = this.getItem(position + 1);
final CourseComponent component = row.component;
final ViewHolder viewHolder = (ViewHolder) convertView.getTag();
if (nextRow == null) {
viewHolder.halfSeparator.setVisibility(View.GONE);
viewHolder.wholeSeparator.setVisibility(View.VISIBLE);
} else {
viewHolder.wholeSeparator.setVisibility(View.GONE);
boolean isLastChildInBlock = !row.component.getParent().getId().equals(nextRow.component.getParent().getId());
if (isLastChildInBlock) {
viewHolder.halfSeparator.setVisibility(View.GONE);
} else {
viewHolder.halfSeparator.setVisibility(View.VISIBLE);
}
}
viewHolder.rowType.setVisibility(View.GONE);
viewHolder.rowSubtitleIcon.setVisibility(View.GONE);
viewHolder.rowSubtitle.setVisibility(View.GONE);
viewHolder.rowSubtitleDueDate.setVisibility(View.GONE);
viewHolder.rowSubtitlePanel.setVisibility(View.GONE);
viewHolder.numOfVideoAndDownloadArea.setVisibility(View.GONE);
if (component.isContainer()) {
getRowViewForContainer(viewHolder, row);
} else {
getRowViewForLeaf(viewHolder, row);
}
return convertView;
}
Aggregations