Search in sources :

Example 1 with FilesAdapter

use of com.instructure.speedgrader.adapters.FilesAdapter in project instructure-android by instructure.

the class RubricHeaderViewHolder method populateAttachments.

private void populateAttachments(ArrayList<Attachment> attachments) {
    FilesAdapter fileAdapter = new FilesAdapter(mContext, R.layout.rubric_spinner_item, attachments);
    fileSpinner.setAdapter(fileAdapter);
    if (currentAttachment != null) {
        setAttachmentSelectionById(currentAttachment.getId());
    }
}
Also used : FilesAdapter(com.instructure.speedgrader.adapters.FilesAdapter)

Example 2 with FilesAdapter

use of com.instructure.speedgrader.adapters.FilesAdapter in project instructure-android by instructure.

the class RubricHeaderViewHolder method getFileSelectListener.

private AdapterView.OnItemSelectedListener getFileSelectListener() {
    return new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            // firstSelectEventFired is a workaround to stop these premature calls to our interface.
            if (firstSelectAttachmentEventFired) {
                Attachment attachment = ((FilesAdapter) fileSpinner.getAdapter()).getItem(position);
                mSubmissionListener.onAttachmentSelected(attachment, mSubmission);
            } else {
                firstSelectAttachmentEventFired = true;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
}
Also used : FilesAdapter(com.instructure.speedgrader.adapters.FilesAdapter) AdapterView(android.widget.AdapterView) Attachment(com.instructure.canvasapi.model.Attachment) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Aggregations

FilesAdapter (com.instructure.speedgrader.adapters.FilesAdapter)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 Attachment (com.instructure.canvasapi.model.Attachment)1 HelveticaTextView (com.instructure.speedgrader.views.HelveticaTextView)1