Search in sources :

Example 1 with FileUploadCoursesAdapter

use of com.instructure.candroid.adapter.FileUploadCoursesAdapter in project instructure-android by instructure.

the class ShareFileDestinationDialog method setupCourseSpinners.

private void setupCourseSpinners() {
    if (studentEnrollmentsAdapter == null) {
        studentEnrollmentsAdapter = new FileUploadCoursesAdapter(getActivity(), getActivity().getLayoutInflater(), FileUploadCoursesAdapter.getFilteredCourseList(courses, FileUploadCoursesAdapter.Type.STUDENT));
        studentCoursesSpinner.setAdapter(studentEnrollmentsAdapter);
    } else {
        studentEnrollmentsAdapter.setCourses(FileUploadCoursesAdapter.getFilteredCourseList(courses, FileUploadCoursesAdapter.Type.STUDENT));
    }
    studentCoursesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            // make the allowed extensions disappear
            Course course = (Course) parent.getAdapter().getItem(position);
            // if the user is a teacher, let them know and don't let them select an assignment
            if (course.getId() > 0) {
                setAssignmentsSpinnerToLoading();
                AssignmentManager.getAllAssignments(course.getId(), false, canvasCallbackAssignments);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
}
Also used : AdapterView(android.widget.AdapterView) Course(com.instructure.canvasapi2.models.Course) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) FileUploadCoursesAdapter(com.instructure.candroid.adapter.FileUploadCoursesAdapter)

Aggregations

CardView (android.support.v7.widget.CardView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 CheckedTextView (android.widget.CheckedTextView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 FileUploadCoursesAdapter (com.instructure.candroid.adapter.FileUploadCoursesAdapter)1 Course (com.instructure.canvasapi2.models.Course)1