use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class FileUtils method showPdfDocument.
public static void showPdfDocument(Uri uri, OpenMediaAsyncTaskLoader.LoadedMedia loadedMedia, final Context context) {
if (!PSPDFKitPreferences.get(context).isAnnotationCreatorSet()) {
User cachedUser = ApiPrefs.getUser();
String userName = "";
if (cachedUser != null) {
userName = ApiPrefs.getUser().getShortName();
}
PSPDFKitPreferences.get(context).setAnnotationCreator(userName);
}
final PdfActivityConfiguration pspdfActivityConfiguration;
if (loadedMedia.isSubmission()) {
// We don't want to allow users to edit for submission viewing
pspdfActivityConfiguration = new PdfActivityConfiguration.Builder(context).scrollDirection(PageScrollDirection.HORIZONTAL).showThumbnailGrid().setThumbnailBarMode(ThumbnailBarMode.THUMBNAIL_BAR_MODE_DEFAULT).disableAnnotationEditing().disableAnnotationList().disableDocumentEditor().fitMode(PageFitMode.FIT_TO_WIDTH).build();
} else {
// Standard behavior
pspdfActivityConfiguration = new PdfActivityConfiguration.Builder(context).scrollDirection(PageScrollDirection.HORIZONTAL).showThumbnailGrid().setThumbnailBarMode(ThumbnailBarMode.THUMBNAIL_BAR_MODE_DEFAULT).enableDocumentEditor().enabledAnnotationTools(setupAnnotationCreationList()).editableAnnotationTypes(setupAnnotationEditList()).fitMode(PageFitMode.FIT_TO_WIDTH).build();
}
if (PSPDFKit.isOpenableUri(context, uri)) {
Intent intent = PdfActivityIntentBuilder.fromUri(context, uri).configuration(pspdfActivityConfiguration).activityClass(CandroidPSPDFActivity.class).build();
context.startActivity(intent);
} else {
// If we still can't open this PDF, we will then attempt to pass it off to the user's pdfviewer
context.startActivity(loadedMedia.getIntent());
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class GradesListRecyclerAdapterTest method testAreContentsTheSame_SameWithSubmissionNullGrade.
@Test
public void testAreContentsTheSame_SameWithSubmissionNullGrade() {
Assignment assignment1 = new Assignment();
assignment1.setName("assignment");
assignment1.setPointsPossible(0.0);
Submission submission1 = new Submission();
submission1.setGrade("A");
assignment1.setSubmission(submission1);
Assignment assignment2 = new Assignment();
assignment2.setName("assignment1");
assignment2.setPointsPossible(0.0);
Submission submission2 = new Submission();
submission1.setGrade(null);
assignment1.setSubmission(submission2);
assertFalse(mAdapter.createItemCallback().areContentsTheSame(assignment1, assignment2));
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class GradesListRecyclerAdapterTest method testAreContentsTheSame_SameWithSubmissionNullChange.
@Test
public void testAreContentsTheSame_SameWithSubmissionNullChange() {
Assignment assignment1 = new Assignment();
assignment1.setName("assignment");
assignment1.setPointsPossible(0.0);
Submission submission1 = new Submission();
submission1.setGrade("A");
assignment1.setSubmission(submission1);
Assignment assignment2 = new Assignment();
assignment2.setName("assignment1");
assignment2.setPointsPossible(0.0);
assignment2.setSubmission(null);
assertFalse(mAdapter.createItemCallback().areContentsTheSame(assignment1, assignment2));
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class AssignmentAPI method getFirstPageSubmissionsForAssignment.
public static void getFirstPageSubmissionsForAssignment(long courseId, long assignmentId, boolean forceNetwork, @NonNull RestBuilder adapter, @NonNull StatusCallback<List<Submission>> callback) {
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
callback.addCall(adapter.build(AssignmentInterface.class, params).getFirstPageSubmissionsForAssignment(courseId, assignmentId)).enqueue(callback);
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager_Test method updateRubricAssessment.
public static void updateRubricAssessment(long courseId, long assignmentId, long studentId, Map<String, RubricCriterionAssessment> assessmentMap, StatusCallback<Submission> callback) {
// TODO:
Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
Submission submission = new Submission();
retrofit2.Response<Submission> response1 = retrofit2.Response.success(submission, response);
callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Aggregations