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);
}
}
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);
}
}
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);
}
}
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);
}
}
});
}
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
}
}
Aggregations