From 89ba2c510bd9d78c0a6a244109acb30fa8fcf2fb Mon Sep 17 00:00:00 2001 From: Christian Frommeyer Date: Sun, 7 Sep 2014 15:01:48 +0200 Subject: [PATCH] More nested classes extracted from LocalStore. --- .../store/local/LocalAttachmentBodyPart.java | 31 +++++++++++ .../fsck/k9/mail/store/local/LocalStore.java | 55 +------------------ .../k9/mail/store/local/LocalTextBody.java | 28 ++++++++++ src/com/fsck/k9/view/AttachmentView.java | 2 +- src/com/fsck/k9/view/SingleMessageView.java | 4 +- 5 files changed, 64 insertions(+), 56 deletions(-) create mode 100644 src/com/fsck/k9/mail/store/local/LocalAttachmentBodyPart.java create mode 100644 src/com/fsck/k9/mail/store/local/LocalTextBody.java diff --git a/src/com/fsck/k9/mail/store/local/LocalAttachmentBodyPart.java b/src/com/fsck/k9/mail/store/local/LocalAttachmentBodyPart.java new file mode 100644 index 000000000..9fcdf71b3 --- /dev/null +++ b/src/com/fsck/k9/mail/store/local/LocalAttachmentBodyPart.java @@ -0,0 +1,31 @@ +package com.fsck.k9.mail.store.local; + +import com.fsck.k9.mail.Body; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.internet.MimeBodyPart; + +public class LocalAttachmentBodyPart extends MimeBodyPart { + private long mAttachmentId = -1; + + public LocalAttachmentBodyPart(Body body, long attachmentId) throws MessagingException { + super(body); + mAttachmentId = attachmentId; + } + + /** + * Returns the local attachment id of this body, or -1 if it is not stored. + * @return + */ + public long getAttachmentId() { + return mAttachmentId; + } + + public void setAttachmentId(long attachmentId) { + mAttachmentId = attachmentId; + } + + @Override + public String toString() { + return "" + mAttachmentId; + } +} \ No newline at end of file diff --git a/src/com/fsck/k9/mail/store/local/LocalStore.java b/src/com/fsck/k9/mail/store/local/LocalStore.java index dde0f0f0c..327cf5388 100644 --- a/src/com/fsck/k9/mail/store/local/LocalStore.java +++ b/src/com/fsck/k9/mail/store/local/LocalStore.java @@ -3473,31 +3473,6 @@ public class LocalStore extends Store implements Serializable { } } - public static class LocalTextBody extends TextBody { - /** - * This is an HTML-ified version of the message for display purposes. - */ - private String mBodyForDisplay; - - public LocalTextBody(String body) { - super(body); - } - - public LocalTextBody(String body, String bodyForDisplay) { - super(body); - this.mBodyForDisplay = bodyForDisplay; - } - - public String getBodyForDisplay() { - return mBodyForDisplay; - } - - public void setBodyForDisplay(String mBodyForDisplay) { - this.mBodyForDisplay = mBodyForDisplay; - } - - }//LocalTextBody - public class LocalMessage extends MimeMessage { private long mId; private int mAttachmentCount; @@ -3593,8 +3568,8 @@ public class LocalStore extends Store implements Serializable { if (part == null) { // If that fails, try and get a text part. part = MimeUtility.findFirstPartByMimeType(this, "text/plain"); - if (part != null && part.getBody() instanceof LocalStore.LocalTextBody) { - text = ((LocalStore.LocalTextBody) part.getBody()).getBodyForDisplay(); + if (part != null && part.getBody() instanceof LocalTextBody) { + text = ((LocalTextBody) part.getBody()).getBodyForDisplay(); } } else { // We successfully found an HTML part; do the necessary character set decoding. @@ -4028,32 +4003,6 @@ public class LocalStore extends Store implements Serializable { } } - public static class LocalAttachmentBodyPart extends MimeBodyPart { - private long mAttachmentId = -1; - - public LocalAttachmentBodyPart(Body body, long attachmentId) throws MessagingException { - super(body); - mAttachmentId = attachmentId; - } - - /** - * Returns the local attachment id of this body, or -1 if it is not stored. - * @return - */ - public long getAttachmentId() { - return mAttachmentId; - } - - public void setAttachmentId(long attachmentId) { - mAttachmentId = attachmentId; - } - - @Override - public String toString() { - return "" + mAttachmentId; - } - } - static class ThreadInfo { public final long threadId; public final long msgId; diff --git a/src/com/fsck/k9/mail/store/local/LocalTextBody.java b/src/com/fsck/k9/mail/store/local/LocalTextBody.java new file mode 100644 index 000000000..c28bccfee --- /dev/null +++ b/src/com/fsck/k9/mail/store/local/LocalTextBody.java @@ -0,0 +1,28 @@ +package com.fsck.k9.mail.store.local; + +import com.fsck.k9.mail.internet.TextBody; + +public class LocalTextBody extends TextBody { + /** + * This is an HTML-ified version of the message for display purposes. + */ + private String mBodyForDisplay; + + public LocalTextBody(String body) { + super(body); + } + + public LocalTextBody(String body, String bodyForDisplay) { + super(body); + this.mBodyForDisplay = bodyForDisplay; + } + + public String getBodyForDisplay() { + return mBodyForDisplay; + } + + public void setBodyForDisplay(String mBodyForDisplay) { + this.mBodyForDisplay = mBodyForDisplay; + } + +}//LocalTextBody \ No newline at end of file diff --git a/src/com/fsck/k9/view/AttachmentView.java b/src/com/fsck/k9/view/AttachmentView.java index 405ecbd99..cffb37c2a 100644 --- a/src/com/fsck/k9/view/AttachmentView.java +++ b/src/com/fsck/k9/view/AttachmentView.java @@ -40,7 +40,7 @@ import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.MimeHeader; import com.fsck.k9.mail.internet.MimeUtility; -import com.fsck.k9.mail.store.local.LocalStore.LocalAttachmentBodyPart; +import com.fsck.k9.mail.store.local.LocalAttachmentBodyPart; import com.fsck.k9.provider.AttachmentProvider; public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener { diff --git a/src/com/fsck/k9/view/SingleMessageView.java b/src/com/fsck/k9/view/SingleMessageView.java index db842707f..f791f030c 100644 --- a/src/com/fsck/k9/view/SingleMessageView.java +++ b/src/com/fsck/k9/view/SingleMessageView.java @@ -55,7 +55,7 @@ import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Multipart; import com.fsck.k9.mail.Part; import com.fsck.k9.mail.internet.MimeUtility; -import com.fsck.k9.mail.store.local.LocalStore; +import com.fsck.k9.mail.store.local.LocalAttachmentBodyPart; import com.fsck.k9.mail.store.local.LocalStore.LocalMessage; import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns; @@ -626,7 +626,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener, for (int i = 0; i < mp.getCount(); i++) { renderAttachments(mp.getBodyPart(i), depth + 1, message, account, controller, listener); } - } else if (part instanceof LocalStore.LocalAttachmentBodyPart) { + } else if (part instanceof LocalAttachmentBodyPart) { AttachmentView view = (AttachmentView)mInflater.inflate(R.layout.message_view_attachment, null); view.setCallback(attachmentCallback);