Search in sources :

Example 41 with CourseComponent

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());
        }
    }
}
Also used : CourseComponent(org.edx.mobile.model.course.CourseComponent)

Example 42 with CourseComponent

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);
        }
    }
}
Also used : View(android.view.View) CourseComponent(org.edx.mobile.model.course.CourseComponent)

Example 43 with CourseComponent

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;
}
Also used : CourseComponent(org.edx.mobile.model.course.CourseComponent)

Aggregations

CourseComponent (org.edx.mobile.model.course.CourseComponent)43 VideoBlockModel (org.edx.mobile.model.course.VideoBlockModel)10 ArrayList (java.util.ArrayList)9 EnrolledCoursesResponse (org.edx.mobile.model.api.EnrolledCoursesResponse)9 Bundle (android.os.Bundle)8 BlockPath (org.edx.mobile.model.course.BlockPath)8 CourseStructureV1Model (org.edx.mobile.model.course.CourseStructureV1Model)8 Test (org.junit.Test)7 View (android.view.View)6 IBlock (org.edx.mobile.model.course.IBlock)6 Intent (android.content.Intent)5 NonNull (android.support.annotation.NonNull)5 DiscussionBlockModel (org.edx.mobile.model.course.DiscussionBlockModel)5 HtmlBlockModel (org.edx.mobile.model.course.HtmlBlockModel)5 TextView (android.widget.TextView)4 IconImageView (com.joanzapata.iconify.widget.IconImageView)4 LinkedHashMap (java.util.LinkedHashMap)4 Fragment (android.support.v4.app.Fragment)3 HashMap (java.util.HashMap)3 CourseContentNotValidException (org.edx.mobile.exception.CourseContentNotValidException)3