use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class AssignmentManager method getAllSubmissionsForAssignment.
public static void getAllSubmissionsForAssignment(long courseId, long assignmentId, final boolean forceNetwork, StatusCallback<List<Submission>> callback) {
if (isTesting() || mTesting) {
AssignmentManager_Test.getAllSubmissionsForAssignment(courseId, assignmentId, callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<Submission>> depaginatedCallback = new ExhaustiveListCallback<Submission>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Submission>> callback, @NonNull String nextUrl, boolean isCached) {
AssignmentAPI.getNextPageSubmissions(nextUrl, adapter, forceNetwork, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AssignmentAPI.getFirstPageSubmissionsForAssignment(courseId, assignmentId, forceNetwork, adapter, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback 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.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class CalendarEventManager method getCalendarEventsExhaustive.
public static void getCalendarEventsExhaustive(final boolean allEvents, @NonNull final CalendarEventAPI.CalendarEventType type, @Nullable final String startDate, @Nullable final String endDate, @NonNull final List<String> canvasContexts, @NonNull StatusCallback<List<ScheduleItem>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
CalendarEventManager_Test.getCalendarEvents(callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<ScheduleItem>> exhaustiveCallback = new ExhaustiveListCallback<ScheduleItem>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<ScheduleItem>> callback, @NonNull String nextUrl, boolean isCached) {
CalendarEventAPI.getCalendarEvents(allEvents, type, startDate, endDate, canvasContexts, adapter, callback, params);
}
};
adapter.setStatusCallback(exhaustiveCallback);
CalendarEventAPI.getCalendarEvents(allEvents, type, startDate, endDate, canvasContexts, adapter, exhaustiveCallback, params);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class CourseManager method getCourses.
public static void getCourses(final boolean forceNetwork, StatusCallback<List<Course>> callback) {
if (isTesting() || mTesting) {
CourseManager_Test.getCourses(callback);
} else {
final RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<Course>> depaginatedCallback = new ExhaustiveListCallback<Course>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<Course>> callback, @NonNull String nextUrl, boolean isCached) {
CourseAPI.getNextPageCourses(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
CourseAPI.getFirstPageCourses(adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.utils.ExhaustiveListCallback in project instructure-android by instructure.
the class CourseManager method getAllCourseStudents.
public static void getAllCourseStudents(final boolean forceNetwork, long courseId, StatusCallback<List<User>> callback) {
if (isTesting() || mTesting) {
// TODO...
} else {
final RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
StatusCallback<List<User>> depaginatedCallback = new ExhaustiveListCallback<User>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<User>> callback, @NonNull String nextUrl, boolean isCached) {
CourseAPI.getNextPageCourseStudents(forceNetwork, nextUrl, adapter, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
CourseAPI.getFirstPageCourseStudents(courseId, adapter, depaginatedCallback, params);
}
}
Aggregations