diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/AttachmentPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/AttachmentPresenter.java index 1ea3481e0..44db23a5a 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/AttachmentPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/AttachmentPresenter.java @@ -162,7 +162,7 @@ public class AttachmentPresenter { if (attachmentViewInfo.inlineAttachment) { continue; } - if (!attachmentViewInfo.isContentAvailable) { + if (!attachmentViewInfo.isContentAvailable()) { allPartsAvailable = false; continue; } diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/AttachmentViewInfo.java b/k9mail/src/main/java/com/fsck/k9/mailstore/AttachmentViewInfo.java index 189225e73..31b04d405 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/AttachmentViewInfo.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/AttachmentViewInfo.java @@ -21,16 +21,24 @@ public class AttachmentViewInfo { public final Uri internalUri; public final boolean inlineAttachment; public final Part part; - public final boolean isContentAvailable; + private boolean contentAvailable; public AttachmentViewInfo(String mimeType, String displayName, long size, Uri internalUri, boolean inlineAttachment, - Part part, boolean isContentAvailable) { + Part part, boolean contentAvailable) { this.mimeType = mimeType; this.displayName = displayName; this.size = size; this.internalUri = internalUri; this.inlineAttachment = inlineAttachment; this.part = part; - this.isContentAvailable = isContentAvailable; + this.contentAvailable = contentAvailable; + } + + public boolean isContentAvailable() { + return contentAvailable; + } + + public void setContentAvailable() { + this.contentAvailable = true; } } diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.java index 5164e691f..e4f5f2bc9 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.java @@ -57,7 +57,7 @@ public class AttachmentController { } public void viewAttachment() { - if (!attachment.isContentAvailable) { + if (!attachment.isContentAvailable()) { downloadAndViewAttachment((LocalPart) attachment.part); } else { viewLocalAttachment(); @@ -100,6 +100,7 @@ public class AttachmentController { controller.loadAttachment(account, message, attachment.part, new SimpleMessagingListener() { @Override public void loadAttachmentFinished(Account account, Message message, Part part) { + attachment.setContentAvailable(); messageViewFragment.hideAttachmentLoadingDialogOnMainThread(); messageViewFragment.runOnMainThread(attachmentDownloadedCallback); } @@ -129,7 +130,7 @@ public class AttachmentController { return; } - if (!attachment.isContentAvailable) { + if (!attachment.isContentAvailable()) { downloadAndSaveAttachmentTo((LocalPart) attachment.part, directory); } else { saveLocalAttachmentTo(directory); diff --git a/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java b/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java index aa5b07b16..c5921c7ed 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/extractors/AttachmentInfoExtractorTest.java @@ -168,7 +168,7 @@ public class AttachmentInfoExtractorTest { AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part); - assertFalse(attachmentViewInfo.isContentAvailable); + assertFalse(attachmentViewInfo.isContentAvailable()); } @Test @@ -178,7 +178,7 @@ public class AttachmentInfoExtractorTest { AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part); - assertTrue(attachmentViewInfo.isContentAvailable); + assertTrue(attachmentViewInfo.isContentAvailable()); } @Test @@ -206,6 +206,6 @@ public class AttachmentInfoExtractorTest { assertEquals(TEST_SIZE, attachmentViewInfo.size); assertEquals(TEST_MIME_TYPE, attachmentViewInfo.mimeType); assertFalse(attachmentViewInfo.inlineAttachment); - assertTrue(attachmentViewInfo.isContentAvailable); + assertTrue(attachmentViewInfo.isContentAvailable()); } }