From 83d876f246734a2880ca3544c1cf2093a358993b Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 20 Oct 2014 21:16:31 -0400 Subject: [PATCH] Inline method --- src/com/fsck/k9/view/AttachmentView.java | 28 +++++++++--------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/com/fsck/k9/view/AttachmentView.java b/src/com/fsck/k9/view/AttachmentView.java index 55a874544..289ea4318 100644 --- a/src/com/fsck/k9/view/AttachmentView.java +++ b/src/com/fsck/k9/view/AttachmentView.java @@ -216,7 +216,16 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo 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())); } - 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() { Uri uri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId()); Intent intent = new Intent(Intent.ACTION_VIEW);