Search in sources :

Example 1 with MediaUploadFragment

use of com.instructure.speedgrader.fragments.MediaUploadFragment in project instructure-android by instructure.

the class DocumentActivity method onAttachmentSelected.

// endregion
// /////////////////////////////////////////////////////////////////////////
// Interface Methods
// /////////////////////////////////////////////////////////////////////////
@Override
public void onAttachmentSelected(Attachment attachment, Submission submission) {
    if (mAdapter == null || mViewpager == null) {
        return;
    }
    currentAttachment = attachment;
    final String submissionType = submission.getSubmissionType();
    if (submissionType != null && submissionType.equals(onlineURL)) {
        final OnlineURLFragment urlFragment = (OnlineURLFragment) mAdapter.getCachedFragment(mViewpager.getCurrentItem());
        urlFragment.setUrlAttachment(attachment, submission.getUrl());
    } else if (submissionType != null && submissionType.equals(mediaUpload)) {
        final MediaUploadFragment mediaUploadFragment = (MediaUploadFragment) mAdapter.getCachedFragment(mViewpager.getCurrentItem());
        mediaUploadFragment.loadMedia(submission);
    } else {
        final SubmissionWebViewFragment webViewFragment = (SubmissionWebViewFragment) mAdapter.getCachedFragment(mViewpager.getCurrentItem());
        webViewFragment.displayAttachment(attachment);
    }
    ((BaseSubmissionView) mAdapter.getCachedFragment(mViewpager.getCurrentItem())).setAttachment(attachment);
}
Also used : SubmissionWebViewFragment(com.instructure.speedgrader.fragments.SubmissionWebViewFragment) BaseSubmissionView(com.instructure.speedgrader.fragments.BaseSubmissionView) OnlineURLFragment(com.instructure.speedgrader.fragments.OnlineURLFragment) MediaUploadFragment(com.instructure.speedgrader.fragments.MediaUploadFragment)

Aggregations

BaseSubmissionView (com.instructure.speedgrader.fragments.BaseSubmissionView)1 MediaUploadFragment (com.instructure.speedgrader.fragments.MediaUploadFragment)1 OnlineURLFragment (com.instructure.speedgrader.fragments.OnlineURLFragment)1 SubmissionWebViewFragment (com.instructure.speedgrader.fragments.SubmissionWebViewFragment)1