use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class QuizManager method getQuizSubmissionTime.
public static void getQuizSubmissionTime(CanvasContext canvasContext, QuizSubmission quizSubmission, boolean forceNetwork, final StatusCallback<QuizSubmissionTime> callback) {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
QuizAPI.getQuizSubmissionTime(canvasContext, quizSubmission.getQuizId(), quizSubmission.getId(), adapter, params, callback);
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class SubmissionManager method postMediaSubmissionComment.
public static void postMediaSubmissionComment(CanvasContext canvasContext, long assignmentId, long studentId, String mediaId, String mediaType, boolean isGroupComment, StatusCallback<Submission> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).build();
SubmissionAPI.postMediaSubmissionComment(canvasContext.getId(), assignmentId, studentId, mediaId, mediaType, isGroupComment, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class UserManager method getAllEnrollmentsPeopleList.
public static void getAllEnrollmentsPeopleList(final CanvasContext canvasContext, StatusCallback<List<User>> callback, final boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
// We don't want the canvas context on the paginated params
final RestParams paginatedParams = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<User>> depaginatedCallback = new ExhaustiveListCallback<User>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<User>> callback, @NonNull String nextUrl, boolean isCached) {
UserAPI.getAllPeopleList(adapter, paginatedParams, canvasContext.getId(), callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
UserAPI.getAllPeopleList(adapter, params, canvasContext.getId(), depaginatedCallback);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class UserManager method getUserForContextId.
public static void getUserForContextId(CanvasContext canvasContext, Long userId, StatusCallback<User> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).withForceReadFromNetwork(forceNetwork).build();
UserAPI.getUserForContextId(adapter, params, canvasContext, userId, callback);
}
}
use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.
the class CanvasContextSpinnerAdapter method newAdapterInstance.
public static CanvasContextSpinnerAdapter newAdapterInstance(Context context, List<Course> courses, List<Group> groups) {
ArrayList<CanvasContext> canvasContexts = new ArrayList<>();
if (!courses.isEmpty()) {
Course courseSeparator = new Course();
courseSeparator.setName(context.getString(R.string.courses));
courseSeparator.setId(COURSE_SEPARATOR);
canvasContexts.add(courseSeparator);
canvasContexts.addAll(courses);
}
if (!groups.isEmpty()) {
Course groupSeparator = new Course();
groupSeparator.setName(context.getString(R.string.groups));
groupSeparator.setId(GROUP_SEPARATOR);
canvasContexts.add(groupSeparator);
canvasContexts.addAll(groups);
}
return new CanvasContextSpinnerAdapter(context, canvasContexts);
}
Aggregations