use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager method editAssignment.
public static void editAssignment(long courseId, long assignmentId, AssignmentPostBody body, final StatusCallback<Assignment> callback, boolean serializeNulls) {
if (isTesting() || mTesting) {
AssignmentManager_Test.editAssignment(body, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
AssignmentPostBodyWrapper bodyWrapper = new AssignmentPostBodyWrapper();
bodyWrapper.setAssignment(body);
AssignmentAPI.editAssignment(courseId, assignmentId, bodyWrapper, adapter, callback, params, serializeNulls);
}
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager method getAssignment.
public static void getAssignment(long assignmentId, long courseId, boolean forceNetwork, StatusCallback<Assignment> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAssignment(assignmentId, courseId, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
AssignmentAPI.getAssignment(courseId, assignmentId, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager method getNextPageAssignments.
public static void getNextPageAssignments(String nextUrl, final boolean forceNetwork, StatusCallback<List<Assignment>> callback) {
if (isTesting() || mTesting) {
} else {
final RestBuilder adapter = new RestBuilder(callback);
AssignmentAPI.getNextPageAssignments(nextUrl, adapter, forceNetwork, callback);
}
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager method getAllAssignments.
public static void getAllAssignments(long courseId, final boolean forceNetwork, StatusCallback<List<Assignment>> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAllAssignments(courseId, callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Assignment>> depaginatedCallback = new ExhaustiveListCallback<Assignment>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Assignment>> callback, @NonNull String nextUrl, boolean isCached) {
AssignmentAPI.getNextPageAssignments(nextUrl, adapter, forceNetwork, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AssignmentAPI.getFirstPageAssignments(courseId, forceNetwork, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentDateListRecyclerAdapter method loadData.
@Override
public void loadData() {
/*Logic regarding MGP is similar here as it is in both assignment recycler adapters,
if changes are made here, check if they are needed in the other recycler adapters.*/
Course course = (Course) mCanvasContext;
// This check is for the "all grading periods" option
if (mCurrentGradingPeriod != null && mCurrentGradingPeriod.getTitle() != null && mCurrentGradingPeriod.getTitle().equals(getContext().getString(R.string.allGradingPeriods))) {
loadAssignment();
return;
}
for (Enrollment enrollment : course.getEnrollments()) {
// Date list is for students
if (enrollment.isMultipleGradingPeriodsEnabled()) {
if (mCurrentGradingPeriod == null || mCurrentGradingPeriod.getTitle() == null) {
// we load current term by setting up the current GP
mCurrentGradingPeriod = new GradingPeriod();
mCurrentGradingPeriod.setId(enrollment.getCurrentGradingPeriodId());
mCurrentGradingPeriod.setTitle(enrollment.getCurrentGradingPeriodTitle());
// request the grading period objects and make the assignment calls
// This callback is fulfilled in the grade list fragment.
CourseManager.getGradingPeriodsForCourse(mGradingPeriodsCallback, course.getId(), true);
// Then we go ahead and load up the assignments for the current period
loadAssignmentsForGradingPeriod(mCurrentGradingPeriod.getId(), false);
return;
} else {
// Otherwise we load the info from the currently selected grading period
loadAssignmentsForGradingPeriod(mCurrentGradingPeriod.getId(), true);
return;
}
}
}
// If we made it this far, MGP is disabled so we just go forward with the standard
loadAssignment();
}
Aggregations