1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Inline method

This commit is contained in:
cketti 2014-10-20 21:16:31 -04:00
parent f6822c973d
commit 83d876f246

View File

@ -216,7 +216,16 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
private void onSaveButtonClicked() { private void onSaveButtonClicked() {
saveFile(); boolean isExternalStorageMounted = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
if (!isExternalStorageMounted) {
String message = context.getString(R.string.message_view_status_attachment_not_saved);
displayMessageToUser(message);
return;
}
if (message != null) {
controller.loadAttachment(account, message, part, new Object[] {true, this}, listener);
}
} }
/** /**
@ -247,23 +256,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
writeFile(new File(K9.getAttachmentDefaultPath())); writeFile(new File(K9.getAttachmentDefaultPath()));
} }
public void saveFile() {
//TODO: Can the user save attachments on the internal filesystem or sd card only?
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
/*
* Abort early if there's no place to save the attachment. We don't want to spend
* the time downloading it and then abort.
*/
String message = context.getString(R.string.message_view_status_attachment_not_saved);
displayMessageToUser(message);
return;
}
if (message != null) {
controller.loadAttachment(account, message, part, new Object[] {true, this}, listener);
}
}
public void showFile() { public void showFile() {
Uri uri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId()); Uri uri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId());
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);