mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
More nested classes extracted from LocalStore.
This commit is contained in:
parent
f92da3af59
commit
89ba2c510b
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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 {
|
public class LocalMessage extends MimeMessage {
|
||||||
private long mId;
|
private long mId;
|
||||||
private int mAttachmentCount;
|
private int mAttachmentCount;
|
||||||
@ -3593,8 +3568,8 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
if (part == null) {
|
if (part == null) {
|
||||||
// If that fails, try and get a text part.
|
// If that fails, try and get a text part.
|
||||||
part = MimeUtility.findFirstPartByMimeType(this, "text/plain");
|
part = MimeUtility.findFirstPartByMimeType(this, "text/plain");
|
||||||
if (part != null && part.getBody() instanceof LocalStore.LocalTextBody) {
|
if (part != null && part.getBody() instanceof LocalTextBody) {
|
||||||
text = ((LocalStore.LocalTextBody) part.getBody()).getBodyForDisplay();
|
text = ((LocalTextBody) part.getBody()).getBodyForDisplay();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We successfully found an HTML part; do the necessary character set decoding.
|
// 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 {
|
static class ThreadInfo {
|
||||||
public final long threadId;
|
public final long threadId;
|
||||||
public final long msgId;
|
public final long msgId;
|
||||||
|
28
src/com/fsck/k9/mail/store/local/LocalTextBody.java
Normal file
28
src/com/fsck/k9/mail/store/local/LocalTextBody.java
Normal file
@ -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
|
@ -40,7 +40,7 @@ import com.fsck.k9.mail.MessagingException;
|
|||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
import com.fsck.k9.mail.internet.MimeHeader;
|
import com.fsck.k9.mail.internet.MimeHeader;
|
||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
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;
|
import com.fsck.k9.provider.AttachmentProvider;
|
||||||
|
|
||||||
public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener {
|
public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener {
|
||||||
|
@ -55,7 +55,7 @@ import com.fsck.k9.mail.MessagingException;
|
|||||||
import com.fsck.k9.mail.Multipart;
|
import com.fsck.k9.mail.Multipart;
|
||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
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.mail.store.local.LocalStore.LocalMessage;
|
||||||
import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;
|
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++) {
|
for (int i = 0; i < mp.getCount(); i++) {
|
||||||
renderAttachments(mp.getBodyPart(i), depth + 1, message, account, controller, listener);
|
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);
|
AttachmentView view = (AttachmentView)mInflater.inflate(R.layout.message_view_attachment, null);
|
||||||
view.setCallback(attachmentCallback);
|
view.setCallback(attachmentCallback);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user