Search in sources :

Example 11 with QuizSubmissionQuestionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse in project instructure-android by instructure.

the class QuizSubmissionQuestionListRecyclerAdapter method addNumericalQuestion.

private void addNumericalQuestion(QuizSubmissionQuestion baseItem, QuizNumericalViewHolder holder, int position, int courseColor) {
    addAnsweredQuestion(baseItem);
    QuizNumericalBinder.bind(holder, baseItem, courseColor, position, shouldLetAnswer, getContext(), flagStateCallback, embeddedWebViewCallback, webViewClientCallback, new QuizPostNumerical() {

        @Override
        public void postNumerical(long questionId, String answer) {
            addAnsweredQuestion(questionId);
            // note: this is the same as the essay question on purpose. Numerical is just text.
            QuizManager.postQuizQuestionEssay(quizSubmission, answer, questionId, true, new StatusCallback<QuizSubmissionQuestionResponse>() {
            });
        }
    });
}
Also used : QuizPostNumerical(com.instructure.candroid.interfaces.QuizPostNumerical) StatusCallback(com.instructure.canvasapi2.StatusCallback)

Example 12 with QuizSubmissionQuestionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse in project instructure-android by instructure.

the class QuizManager method postQuizQuestionMultipleDropdown.

public static void postQuizQuestionMultipleDropdown(QuizSubmission quizSubmission, long questionId, HashMap<String, Long> answers, boolean forceNetwork, @NonNull StatusCallback<QuizSubmissionQuestionResponse> callback) {
    final RestBuilder adapter = new RestBuilder(callback);
    final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
    QuizAPI.postQuizQuestionMultipleDropdown(quizSubmission, questionId, answers, adapter, params, callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 13 with QuizSubmissionQuestionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse in project instructure-android by instructure.

the class QuizManager method getQuizSubmissionQuestions.

public static void getQuizSubmissionQuestions(long quizSubmissionId, StatusCallback<QuizSubmissionQuestionResponse> callback) {
    if (isTesting() || mTesting) {
        QuizManager_Test.getQuizSubmissionQuestions(quizSubmissionId, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
        QuizAPI.getQuizSubmissionQuestions(quizSubmissionId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 14 with QuizSubmissionQuestionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse in project instructure-android by instructure.

the class QuizManager method getNextPageSubmissionQuestions.

public static void getNextPageSubmissionQuestions(String nextUrl, boolean forceNetwork, @NonNull StatusCallback<QuizSubmissionQuestionResponse> callback) {
    final RestBuilder adapter = new RestBuilder(callback);
    final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
    QuizAPI.getNextPageSubmissionQuestions(nextUrl, adapter, params, callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 15 with QuizSubmissionQuestionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse in project instructure-android by instructure.

the class QuizManager method postQuizQuestionEssay.

public static void postQuizQuestionEssay(QuizSubmission quizSubmission, String answer, long questionId, boolean forceNetwork, @NonNull StatusCallback<QuizSubmissionQuestionResponse> callback) {
    final RestBuilder adapter = new RestBuilder(callback);
    final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
    QuizAPI.postQuizQuestionEssay(quizSubmission, questionId, answer, adapter, params, callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)9 RestParams (com.instructure.canvasapi2.builders.RestParams)9 StatusCallback (com.instructure.canvasapi2.StatusCallback)5 QuizSubmissionQuestion (com.instructure.canvasapi2.models.QuizSubmissionQuestion)4 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)4 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)4 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)4 ApiType (com.instructure.canvasapi2.utils.ApiType)3 NonNull (android.support.annotation.NonNull)2 LinkedTreeMap (com.google.gson.internal.LinkedTreeMap)2 ArrayList (java.util.ArrayList)2 Response (retrofit2.Response)2 Bundle (android.os.Bundle)1 QuizSubmissionQuestionListRecyclerAdapter (com.instructure.candroid.adapter.QuizSubmissionQuestionListRecyclerAdapter)1 QuizFileUploadListener (com.instructure.candroid.interfaces.QuizFileUploadListener)1 QuizPostEssay (com.instructure.candroid.interfaces.QuizPostEssay)1 QuizPostMatching (com.instructure.candroid.interfaces.QuizPostMatching)1 QuizPostMultiChoice (com.instructure.candroid.interfaces.QuizPostMultiChoice)1 QuizPostMultipleDropdown (com.instructure.candroid.interfaces.QuizPostMultipleDropdown)1 QuizPostNumerical (com.instructure.candroid.interfaces.QuizPostNumerical)1