Search in sources :

Example 6 with Quiz

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

the class QuizManager method getQuizzes.

public static void getQuizzes(long courseId, final boolean forceNetwork, StatusCallback<List<Quiz>> callback) {
    if (isTesting() || mTesting) {
        QuizManager_Test.getQuizesQuestions(callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        QuizAPI.getQuizzes(courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 7 with Quiz

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

the class QuizManager method getQuiz.

public static void getQuiz(long courseId, long quizId, final boolean forceNetwork, StatusCallback<Quiz> callback) {
    if (isTesting() || mTesting) {
        QuizManager_Test.getQuiz(callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        QuizAPI.getQuiz(courseId, quizId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 8 with Quiz

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

the class QuizManager method editQuiz.

public static void editQuiz(long courseId, long quizId, QuizPostBody body, final StatusCallback<Quiz> callback) {
    if (isTesting() || mTesting) {
        QuizManager_Test.editQuiz(body, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
        QuizPostBodyWrapper bodyWrapper = new QuizPostBodyWrapper();
        bodyWrapper.setQuiz(body);
        QuizAPI.editQuiz(courseId, quizId, bodyWrapper, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) QuizPostBodyWrapper(com.instructure.canvasapi2.models.post_models.QuizPostBodyWrapper) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 9 with Quiz

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

the class QuizAPI method getFirstPageQuizzes.

public static void getFirstPageQuizzes(long contextId, boolean forceNetwork, @NonNull RestBuilder adapter, @NonNull StatusCallback<List<Quiz>> callback) {
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
    callback.addCall(adapter.build(QuizInterface.class, params).getFirstPageQuizzes(contextId)).enqueue(callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 10 with Quiz

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

the class QuizAPI method getNextPageQuizzes.

public static void getNextPageQuizzes(boolean forceNetwork, String nextUrl, RestBuilder adapter, @NonNull StatusCallback<List<Quiz>> callback) {
    RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
    callback.addCall(adapter.build(QuizInterface.class, params).getNextPageQuizzes(nextUrl)).enqueue(callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)10 RestParams (com.instructure.canvasapi2.builders.RestParams)9 Quiz (com.instructure.canvasapi2.models.Quiz)5 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)4 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)4 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)3 ArrayList (java.util.ArrayList)3 Response (okhttp3.Response)3 Bundle (android.os.Bundle)2 NonNull (android.support.annotation.NonNull)2 StatusCallback (com.instructure.canvasapi2.StatusCallback)2 Course (com.instructure.canvasapi2.models.Course)2 List (java.util.List)2 Request (okhttp3.Request)2 Intent (android.content.Intent)1 Paint (android.graphics.Paint)1 AlertDialog (android.support.v7.app.AlertDialog)1 KeyEvent (android.view.KeyEvent)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1