mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
new MessageViewInfo structure (with transitional methods)
This commit is contained in:
parent
0e03f262b3
commit
40b6228756
@ -1,20 +1,54 @@
|
||||
package com.fsck.k9.mailstore;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.fsck.k9.mail.Message;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
|
||||
|
||||
public class MessageViewInfo {
|
||||
public final String text;
|
||||
public final List<AttachmentViewInfo> attachments;
|
||||
public final Message message;
|
||||
|
||||
public final Message message;
|
||||
public final List<MessageViewContainer> containers = new ArrayList<MessageViewContainer>();
|
||||
|
||||
@Deprecated
|
||||
public MessageViewInfo(String text, List<AttachmentViewInfo> attachments, Message message) {
|
||||
this.text = text;
|
||||
this.attachments = Collections.unmodifiableList(attachments);
|
||||
containers.add(new MessageViewContainer(text, attachments));
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getText() {
|
||||
return containers.get(0).text;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<AttachmentViewInfo> getAttachments() {
|
||||
return containers.get(0).attachments;
|
||||
}
|
||||
|
||||
public static class MessageViewContainer {
|
||||
|
||||
final public String text;
|
||||
final public List<AttachmentViewInfo> attachments;
|
||||
final public OpenPgpSignatureResult signatureResult;
|
||||
|
||||
MessageViewContainer(String text, List<AttachmentViewInfo> attachments) {
|
||||
this.text = text;
|
||||
this.attachments = attachments;
|
||||
this.signatureResult = null;
|
||||
}
|
||||
|
||||
MessageViewContainer(String text, List<AttachmentViewInfo> attachments,
|
||||
OpenPgpSignatureResult signatureResult) {
|
||||
this.text = text;
|
||||
this.attachments = attachments;
|
||||
this.signatureResult = signatureResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -533,13 +533,13 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
}
|
||||
|
||||
if (text == null) {
|
||||
text = messageViewInfo.text;
|
||||
text = messageViewInfo.getText();
|
||||
}
|
||||
|
||||
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
|
||||
mText = text;
|
||||
|
||||
mHasAttachments = !messageViewInfo.attachments.isEmpty();
|
||||
mHasAttachments = !messageViewInfo.getAttachments().isEmpty();
|
||||
if (mHasAttachments) {
|
||||
renderAttachments(messageViewInfo);
|
||||
}
|
||||
@ -616,7 +616,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
}
|
||||
|
||||
public void renderAttachments(MessageViewInfo messageContainer) throws MessagingException {
|
||||
for (AttachmentViewInfo attachment : messageContainer.attachments) {
|
||||
for (AttachmentViewInfo attachment : messageContainer.getAttachments()) {
|
||||
AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, null);
|
||||
view.setCallback(attachmentCallback);
|
||||
view.setAttachment(attachment);
|
||||
|
Loading…
Reference in New Issue
Block a user