Search in sources :

Example 1 with MoodleWebService

use of ca.etsmtl.applets.etsmobile.http.MoodleWebService in project ETSMobile-Android2 by ApplETS.

the class MoodleCourseDetailsFragment method queryMoodleCoreCourses.

/**
 * Query all resources for a Moodle course
 *
 * @param idCourse
 */
private void queryMoodleCoreCourses(final String idCourse) {
    MoodleWebService service = dataManager.getMoodleService();
    Call<List<MoodleCoreCourse>> courseCall = service.getCoreCourses(ApplicationManager.userCredentials.getMoodleToken(), Integer.parseInt(idCourse));
    courseCall.enqueue(new Callback<List<MoodleCoreCourse>>() {

        @Override
        public void onResponse(Call<List<MoodleCoreCourse>> call, Response<List<MoodleCoreCourse>> response) {
            if (response.isSuccessful() && response.body() != null) {
                displayMoodleCourses(response.body());
            }
        }

        @Override
        public void onFailure(Call<List<MoodleCoreCourse>> call, Throwable t) {
            Snackbar.make(getView(), R.string.moodle_error_cant_get_courses, Snackbar.LENGTH_SHORT).show();
        }
    });
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) MoodleWebService(ca.etsmtl.applets.etsmobile.http.MoodleWebService)

Aggregations

MoodleWebService (ca.etsmtl.applets.etsmobile.http.MoodleWebService)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1