use of com.instructure.speedgrader.dialogs.EditAssignmentDialog in project instructure-android by instructure.
the class DocumentActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Submission currentSubmission = getCurrentSubmissionInViewpager();
int id = item.getItemId();
switch(id) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.edit_assignments:
genericDialog = new EditAssignmentDialog();
genericDialog.setArguments(EditAssignmentDialog.createBundle(mAssignment, (Course) mCanvasContext));
genericDialog.show(getSupportFragmentManager(), EditAssignmentDialog.TAG);
return true;
case R.id.download:
if (currentAttachment != null) {
downloadFile(currentAttachment.getUrl(), currentAttachment.getFilename());
} else if (currentSubmission.getSubmissionType() != null && currentSubmission.getSubmissionType().equals(mediaUpload)) {
downloadFile(currentSubmission.getMediaComment().getUrl(), currentSubmission.getMediaComment().getFileName());
} else {
Toast.makeText(DocumentActivity.this, getString(R.string.nothingToDownload), Toast.LENGTH_SHORT).show();
}
return true;
case R.id.open_browser:
if (currentAttachment != null) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(currentAttachment.getUrl())));
} else {
Toast.makeText(DocumentActivity.this, getString(R.string.nothingToShowInBrowser), Toast.LENGTH_SHORT).show();
}
return true;
}
return super.onOptionsItemSelected(item);
}
Aggregations