Search in sources :

Example 76 with Course

use of com.instructure.canvasapi2.models.Course in project instructure-android by instructure.

the class CourseManager method getCourseWithGradeAirwolf.

// region Airwolf
public static void getCourseWithGradeAirwolf(String airwolfDomain, String parentId, String studentId, long courseId, StatusCallback<Course> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withDomain(airwolfDomain).withAPIVersion("").build();
        CourseAPI.getCourseWithGradeAirwolf(parentId, studentId, courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 77 with Course

use of com.instructure.canvasapi2.models.Course in project instructure-android by instructure.

the class CourseManager method getCourseWithSyllabusAirwolf.

public static void getCourseWithSyllabusAirwolf(String airwolfDomain, String parentId, String studentId, long courseId, StatusCallback<Course> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withDomain(airwolfDomain).withAPIVersion("").build();
        CourseAPI.getCourseWithSyllabusAirwolf(parentId, studentId, courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 78 with Course

use of com.instructure.canvasapi2.models.Course in project instructure-android by instructure.

the class CourseManager method editCourseName.

public static void editCourseName(long courseId, String newCourseName, StatusCallback<Course> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
    // TODO:
    // CourseManager_Test.editCourseName(courseId, callback);
    } else {
        Map<String, String> queryParams = new HashMap<>();
        queryParams.put("course[name]", newCourseName);
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseAPI.updateCourse(courseId, queryParams, adapter, callback, params);
    }
}
Also used : HashMap(java.util.HashMap) RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 79 with Course

use of com.instructure.canvasapi2.models.Course in project instructure-android by instructure.

the class GradesListFragment method configureViews.

public void configureViews(View rootView) {
    // Not handled automatically as we cast from canvasContext;
    if (course == null) {
        return;
    }
    termSpinner = rootView.findViewById(R.id.termSpinner);
    AppBarLayout appBarLayout = rootView.findViewById(R.id.appbar);
    totalGradeView = rootView.findViewById(R.id.txtOverallGrade);
    showBasedOnGradedAssignmentsCB = rootView.findViewById(R.id.showTotalCheckBox);
    showWhatIfCheckbox = rootView.findViewById(R.id.showWhatIfCheckBox);
    toggleGradeView = rootView.findViewById(R.id.grade_toggle_view);
    toggleWhatIfScores = rootView.findViewById(R.id.what_if_view);
    Drawable lockDrawable = ColorKeeper.getColoredDrawable(getContext(), R.drawable.vd_lock, getResources().getColor(R.color.canvasTextDark));
    lockedGradeImage = rootView.findViewById(R.id.lockedGradeImage);
    lockedGradeImage.setImageDrawable(lockDrawable);
    setupListeners();
    lockGrade(course.isHideFinalGrades());
    dialogStyled = new WhatIfDialogStyled.WhatIfDialogCallback() {

        @Override
        public void onOkayClick(String whatIf, double total, Assignment assignment, int position) {
            // Create dummy submission for what if grade
            Submission s = new Submission();
            // check to see if grade is empty for reset
            if (TextUtils.isEmpty(whatIf)) {
                assignment.setSubmission(null);
                recyclerAdapter.getAssignmentsHash().get(assignment.getId()).setSubmission(null);
            } else {
                s.setScore(Double.parseDouble(whatIf));
                s.setGrade(whatIf);
                recyclerAdapter.getAssignmentsHash().get(assignment.getId()).setSubmission(s);
            }
            recyclerAdapter.notifyItemChanged(position);
            // Compute new overall grade
            new ComputeGradesTask(showBasedOnGradedAssignmentsCB.isChecked()).execute();
        }
    };
    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {

        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
            // workaround for Toolbar not showing with swipe to refresh
            if (i == 0) {
                setRefreshingEnabled(true);
            } else {
                setRefreshingEnabled(false);
            }
        }
    });
}
Also used : WhatIfDialogStyled(com.instructure.candroid.dialog.WhatIfDialogStyled) Assignment(com.instructure.canvasapi2.models.Assignment) Submission(com.instructure.canvasapi2.models.Submission) Drawable(android.graphics.drawable.Drawable) AppBarLayout(android.support.design.widget.AppBarLayout)

Example 80 with Course

use of com.instructure.canvasapi2.models.Course in project instructure-android by instructure.

the class NotificationListFragment method applyTheme.

@Override
public void applyTheme() {
    CanvasContext canvasContext = getCanvasContext();
    if (canvasContext instanceof Course || canvasContext instanceof Group) {
        PandaViewUtils.setupToolbarBackButton(mToolbar, this);
        ViewStyler.themeToolbar(getActivity(), mToolbar, canvasContext);
    } else {
        Navigation navigation = getNavigation();
        if (navigation != null)
            navigation.attachNavigationDrawer(this, mToolbar);
    // Styling done in attachNavigationDrawer
    }
}
Also used : ViewGroup(android.view.ViewGroup) Group(com.instructure.canvasapi2.models.Group) Navigation(com.instructure.interactions.Navigation) CanvasContext(com.instructure.canvasapi2.models.CanvasContext) Course(com.instructure.canvasapi2.models.Course)

Aggregations

Course (com.instructure.canvasapi2.models.Course)106 Test (org.junit.Test)70 ArrayList (java.util.ArrayList)39 Enrollment (com.instructure.canvasapi2.models.Enrollment)29 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)17 RestParams (com.instructure.canvasapi2.builders.RestParams)17 View (android.view.View)13 Bundle (android.os.Bundle)10 TextView (android.widget.TextView)10 NonNull (android.support.annotation.NonNull)8 AdapterView (android.widget.AdapterView)8 ModuleItem (com.instructure.canvasapi2.models.ModuleItem)8 ParentFragment (com.instructure.candroid.fragment.ParentFragment)7 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)7 ImageView (android.widget.ImageView)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 List (java.util.List)6 BindView (butterknife.BindView)5 RecyclerView (android.support.v7.widget.RecyclerView)4 StatusCallback (com.instructure.canvasapi2.StatusCallback)4