mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
extract header view for multiple MessageContainerViews (intermediate state)
This commit is contained in:
parent
29ad0f0f99
commit
445c978f31
@ -16,20 +16,12 @@ public class MessageViewInfo {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public MessageViewInfo(String text, List<AttachmentViewInfo> attachments, Message message) {
|
public MessageViewInfo(String text, List<AttachmentViewInfo> attachments, Message message) {
|
||||||
|
containers.add(new MessageViewContainer(text, attachments));
|
||||||
|
// FIXME just display it twice, for testing only
|
||||||
containers.add(new MessageViewContainer(text, attachments));
|
containers.add(new MessageViewContainer(text, attachments));
|
||||||
this.message = message;
|
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 {
|
public static class MessageViewContainer {
|
||||||
|
|
||||||
final public String text;
|
final public String text;
|
||||||
|
@ -20,7 +20,6 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
@ -55,9 +54,9 @@ import com.fsck.k9.mail.MessagingException;
|
|||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
import com.fsck.k9.mail.internet.MimeUtility;
|
||||||
import com.fsck.k9.mailstore.AttachmentViewInfo;
|
import com.fsck.k9.mailstore.AttachmentViewInfo;
|
||||||
import com.fsck.k9.mailstore.MessageViewInfo;
|
import com.fsck.k9.mailstore.MessageViewInfo;
|
||||||
|
import com.fsck.k9.mailstore.MessageViewInfo.MessageViewContainer;
|
||||||
import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;
|
import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;
|
||||||
|
|
||||||
import com.fsck.k9.view.MessageHeader;
|
|
||||||
import com.fsck.k9.view.MessageHeader.OnLayoutChangedListener;
|
import com.fsck.k9.view.MessageHeader.OnLayoutChangedListener;
|
||||||
import com.fsck.k9.view.MessageWebView;
|
import com.fsck.k9.view.MessageWebView;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@ -90,7 +89,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
|
|
||||||
private MessageOpenPgpView mOpenPgpView;
|
private MessageOpenPgpView mOpenPgpView;
|
||||||
private MessageWebView mMessageContentView;
|
private MessageWebView mMessageContentView;
|
||||||
private MessageHeader mHeaderContainer;
|
|
||||||
private LinearLayout mAttachments;
|
private LinearLayout mAttachments;
|
||||||
private Button mShowHiddenAttachments;
|
private Button mShowHiddenAttachments;
|
||||||
private LinearLayout mHiddenAttachments;
|
private LinearLayout mHiddenAttachments;
|
||||||
@ -117,18 +115,12 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
activity.registerForContextMenu(mMessageContentView);
|
activity.registerForContextMenu(mMessageContentView);
|
||||||
mMessageContentView.setOnCreateContextMenuListener(this);
|
mMessageContentView.setOnCreateContextMenuListener(this);
|
||||||
|
|
||||||
mHeaderContainer = (MessageHeader) findViewById(R.id.header_container);
|
|
||||||
mHeaderContainer.setOnLayoutChangedListener(this);
|
|
||||||
|
|
||||||
mAttachmentsContainer = findViewById(R.id.attachments_container);
|
mAttachmentsContainer = findViewById(R.id.attachments_container);
|
||||||
mAttachments = (LinearLayout) findViewById(R.id.attachments);
|
mAttachments = (LinearLayout) findViewById(R.id.attachments);
|
||||||
mHiddenAttachments = (LinearLayout) findViewById(R.id.hidden_attachments);
|
mHiddenAttachments = (LinearLayout) findViewById(R.id.hidden_attachments);
|
||||||
mHiddenAttachments.setVisibility(View.GONE);
|
mHiddenAttachments.setVisibility(View.GONE);
|
||||||
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
||||||
mShowHiddenAttachments.setVisibility(View.GONE);
|
mShowHiddenAttachments.setVisibility(View.GONE);
|
||||||
mOpenPgpView = (MessageOpenPgpView) findViewById(R.id.layout_decrypt_openpgp);
|
|
||||||
mOpenPgpView.setFragment(fragment);
|
|
||||||
mOpenPgpView.setupChildViews();
|
|
||||||
mShowPicturesAction = findViewById(R.id.show_pictures);
|
mShowPicturesAction = findViewById(R.id.show_pictures);
|
||||||
mShowMessageAction = findViewById(R.id.show_message);
|
mShowMessageAction = findViewById(R.id.show_message);
|
||||||
|
|
||||||
@ -139,8 +131,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
mContacts = Contacts.getInstance(activity);
|
mContacts = Contacts.getInstance(activity);
|
||||||
|
|
||||||
mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater();
|
mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater();
|
||||||
mDownloadRemainder = (Button) findViewById(R.id.download_remainder);
|
// mDownloadRemainder = (Button) findViewById(R.id.download_remainder);
|
||||||
mDownloadRemainder.setVisibility(View.GONE);
|
// mDownloadRemainder.setVisibility(View.GONE);
|
||||||
mAttachmentsContainer.setVisibility(View.GONE);
|
mAttachmentsContainer.setVisibility(View.GONE);
|
||||||
mMessageContentView.setVisibility(View.VISIBLE);
|
mMessageContentView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -148,14 +140,13 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
// titlebar, which is really unfair.
|
// titlebar, which is really unfair.
|
||||||
TypedValue outValue = new TypedValue();
|
TypedValue outValue = new TypedValue();
|
||||||
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
|
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
|
||||||
mHeaderContainer.setBackgroundColor(outValue.data);
|
|
||||||
// also set background of the whole view (including the attachments view)
|
// also set background of the whole view (including the attachments view)
|
||||||
setBackgroundColor(outValue.data);
|
setBackgroundColor(outValue.data);
|
||||||
|
|
||||||
mShowHiddenAttachments.setOnClickListener(this);
|
mShowHiddenAttachments.setOnClickListener(this);
|
||||||
mShowMessageAction.setOnClickListener(this);
|
// mShowMessageAction.setOnClickListener(this);
|
||||||
mShowAttachmentsAction.setOnClickListener(this);
|
// mShowAttachmentsAction.setOnClickListener(this);
|
||||||
mShowPicturesAction.setOnClickListener(this);
|
// mShowPicturesAction.setOnClickListener(this);
|
||||||
|
|
||||||
mClipboardManager = ClipboardManager.getInstance(activity);
|
mClipboardManager = ClipboardManager.getInstance(activity);
|
||||||
}
|
}
|
||||||
@ -446,37 +437,13 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showShowPicturesAction(boolean show) {
|
public void showShowPicturesAction(boolean show) {
|
||||||
mShowPicturesAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
// mShowPicturesAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
public void showShowMessageAction(boolean show) {
|
public void showShowMessageAction(boolean show) {
|
||||||
mShowMessageAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
// mShowMessageAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
public void showShowAttachmentsAction(boolean show) {
|
public void showShowAttachmentsAction(boolean show) {
|
||||||
mShowAttachmentsAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
// mShowAttachmentsAction.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the message header view. This is not the same as the message headers; this is the View shown at the top
|
|
||||||
* of messages.
|
|
||||||
* @return MessageHeader View.
|
|
||||||
*/
|
|
||||||
public MessageHeader getMessageHeaderView() {
|
|
||||||
return mHeaderContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeaders(final Message message, Account account) {
|
|
||||||
try {
|
|
||||||
mHeaderContainer.populate(message, account);
|
|
||||||
mHeaderContainer.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception me) {
|
|
||||||
Log.e(K9.LOG_TAG, "setHeaders - error", me);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnToggleFlagClickListener(OnClickListener listener) {
|
|
||||||
mHeaderContainer.setOnFlagListener(listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnDownloadButtonClickListener(OnClickListener listener) {
|
public void setOnDownloadButtonClickListener(OnClickListener listener) {
|
||||||
@ -512,36 +479,16 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showAllHeaders() {
|
public void setMessage(MessageViewContainer messageViewContainer)
|
||||||
mHeaderContainer.onShowAdditionalHeaders();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean additionalHeadersVisible() {
|
|
||||||
return mHeaderContainer.additionalHeadersVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(Account account, MessageViewInfo messageViewInfo, PgpData pgpData)
|
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
resetView();
|
resetView();
|
||||||
|
|
||||||
String text = null;
|
|
||||||
if (pgpData != null) {
|
|
||||||
text = pgpData.getDecryptedData();
|
|
||||||
if (text != null) {
|
|
||||||
text = HtmlConverter.textToHtml(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text == null) {
|
|
||||||
text = messageViewInfo.getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
|
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
|
||||||
mText = text;
|
mText = messageViewContainer.text;
|
||||||
|
|
||||||
mHasAttachments = !messageViewInfo.getAttachments().isEmpty();
|
mHasAttachments = !messageViewContainer.attachments.isEmpty();
|
||||||
if (mHasAttachments) {
|
if (mHasAttachments) {
|
||||||
renderAttachments(messageViewInfo);
|
renderAttachments(messageViewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
mHiddenAttachments.setVisibility(View.GONE);
|
mHiddenAttachments.setVisibility(View.GONE);
|
||||||
@ -568,12 +515,13 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
onShowMessage();
|
onShowMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (text != null && lookForImages) {
|
if (text != null && lookForImages) {
|
||||||
// If the message contains external pictures and the "Show pictures"
|
// If the message contains external pictures and the "Show pictures"
|
||||||
// button wasn't already pressed, see if the user's preferences has us
|
// button wasn't already pressed, see if the user's preferences has us
|
||||||
// showing them anyway.
|
// showing them anyway.
|
||||||
if (Utility.hasExternalImages(text) && !showPictures()) {
|
if (Utility.hasExternalImages(text) && !showPictures()) {
|
||||||
Address[] from = messageViewInfo.message.getFrom();
|
Address[] from = messageViewContainer.message.getFrom();
|
||||||
if ((account.getShowPictures() == Account.ShowPictures.ALWAYS) ||
|
if ((account.getShowPictures() == Account.ShowPictures.ALWAYS) ||
|
||||||
((account.getShowPictures() == Account.ShowPictures.ONLY_FROM_CONTACTS) &&
|
((account.getShowPictures() == Account.ShowPictures.ONLY_FROM_CONTACTS) &&
|
||||||
// Make sure we have at least one from address
|
// Make sure we have at least one from address
|
||||||
@ -585,11 +533,10 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (text != null) {
|
if (mText != null) {
|
||||||
loadBodyFromText(text);
|
loadBodyFromText(mText);
|
||||||
mOpenPgpView.updateLayout(account, pgpData.getDecryptedData(),
|
|
||||||
pgpData.getSignatureResult(), messageViewInfo.message);
|
|
||||||
} else {
|
} else {
|
||||||
showStatusMessage(getContext().getString(R.string.webview_empty_message));
|
showStatusMessage(getContext().getString(R.string.webview_empty_message));
|
||||||
}
|
}
|
||||||
@ -615,8 +562,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
mMessageContentView.setVisibility(show ? View.VISIBLE : View.GONE);
|
mMessageContentView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderAttachments(MessageViewInfo messageContainer) throws MessagingException {
|
public void renderAttachments(MessageViewContainer messageContainer) throws MessagingException {
|
||||||
for (AttachmentViewInfo attachment : messageContainer.getAttachments()) {
|
for (AttachmentViewInfo attachment : messageContainer.attachments) {
|
||||||
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);
|
||||||
view.setAttachment(attachment);
|
view.setAttachment(attachment);
|
||||||
@ -652,7 +599,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetView() {
|
public void resetView() {
|
||||||
mDownloadRemainder.setVisibility(View.GONE);
|
// mDownloadRemainder.setVisibility(View.GONE);
|
||||||
setLoadPictures(false);
|
setLoadPictures(false);
|
||||||
showShowAttachmentsAction(false);
|
showShowAttachmentsAction(false);
|
||||||
showShowMessageAction(false);
|
showShowMessageAction(false);
|
||||||
@ -670,10 +617,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
loadBodyFromText("");
|
loadBodyFromText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetHeaderView() {
|
|
||||||
mHeaderContainer.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttachmentCallback(AttachmentViewCallback attachmentCallback) {
|
public void setAttachmentCallback(AttachmentViewCallback attachmentCallback) {
|
||||||
this.attachmentCallback = attachmentCallback;
|
this.attachmentCallback = attachmentCallback;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package com.fsck.k9.ui.messageview;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import com.fsck.k9.Account;
|
||||||
|
import com.fsck.k9.K9;
|
||||||
|
import com.fsck.k9.R;
|
||||||
|
import com.fsck.k9.crypto.PgpData;
|
||||||
|
import com.fsck.k9.mail.Message;
|
||||||
|
import com.fsck.k9.mail.MessagingException;
|
||||||
|
import com.fsck.k9.mailstore.MessageViewInfo;
|
||||||
|
import com.fsck.k9.mailstore.MessageViewInfo.MessageViewContainer;
|
||||||
|
import com.fsck.k9.view.MessageHeader;
|
||||||
|
|
||||||
|
|
||||||
|
public class MessageTopView extends LinearLayout {
|
||||||
|
|
||||||
|
private MessageHeader mHeaderContainer;
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
private LinearLayout containerViews;
|
||||||
|
private Fragment fragment;
|
||||||
|
|
||||||
|
public MessageTopView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialize (Fragment fragment) {
|
||||||
|
this.fragment = fragment;
|
||||||
|
Activity activity = fragment.getActivity();
|
||||||
|
|
||||||
|
mHeaderContainer = (MessageHeader) findViewById(R.id.header_container);
|
||||||
|
// mHeaderContainer.setOnLayoutChangedListener(this);
|
||||||
|
mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater();
|
||||||
|
|
||||||
|
TypedValue outValue = new TypedValue();
|
||||||
|
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
|
||||||
|
mHeaderContainer.setBackgroundColor(outValue.data);
|
||||||
|
|
||||||
|
containerViews = (LinearLayout) findViewById(R.id.message_containers);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetView() {
|
||||||
|
// mDownloadRemainder.setVisibility(View.GONE);
|
||||||
|
containerViews.removeAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(Account account, MessageViewInfo messageViewInfo)
|
||||||
|
throws MessagingException {
|
||||||
|
resetView();
|
||||||
|
|
||||||
|
for (MessageViewContainer container : messageViewInfo.containers) {
|
||||||
|
MessageContainerView view = (MessageContainerView) mInflater.inflate(R.layout.message_container, null);
|
||||||
|
view.initialize(fragment);
|
||||||
|
view.setMessage(container);
|
||||||
|
containerViews.addView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the message header view. This is not the same as the message headers; this is the View shown at the top
|
||||||
|
* of messages.
|
||||||
|
* @return MessageHeader View.
|
||||||
|
*/
|
||||||
|
public MessageHeader getMessageHeaderView() {
|
||||||
|
return mHeaderContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaders(final Message message, Account account) {
|
||||||
|
try {
|
||||||
|
mHeaderContainer.populate(message, account);
|
||||||
|
mHeaderContainer.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception me) {
|
||||||
|
Log.e(K9.LOG_TAG, "setHeaders - error", me);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnToggleFlagClickListener(OnClickListener listener) {
|
||||||
|
mHeaderContainer.setOnFlagListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAllHeaders() {
|
||||||
|
mHeaderContainer.onShowAdditionalHeaders();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean additionalHeadersVisible() {
|
||||||
|
return mHeaderContainer.additionalHeadersVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetHeaderView() {
|
||||||
|
mHeaderContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -78,7 +78,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private SingleMessageView mMessageView;
|
private MessageTopView mMessageView;
|
||||||
private PgpData mPgpData;
|
private PgpData mPgpData;
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
private MessageReference mMessageReference;
|
private MessageReference mMessageReference;
|
||||||
@ -145,9 +145,9 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
View view = mLayoutInflater.inflate(R.layout.message, container, false);
|
View view = mLayoutInflater.inflate(R.layout.message, container, false);
|
||||||
|
|
||||||
|
|
||||||
mMessageView = (SingleMessageView) view.findViewById(R.id.message_view);
|
mMessageView = (MessageTopView) view.findViewById(R.id.message_view);
|
||||||
|
|
||||||
mMessageView.setAttachmentCallback(this);
|
// mMessageView.setAttachmentCallback(this);
|
||||||
|
|
||||||
mMessageView.initialize(this);
|
mMessageView.initialize(this);
|
||||||
mMessageView.setOnToggleFlagClickListener(new OnClickListener() {
|
mMessageView.setOnToggleFlagClickListener(new OnClickListener() {
|
||||||
@ -156,12 +156,13 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
onToggleFlagged();
|
onToggleFlagged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mMessageView.setOnDownloadButtonClickListener(new OnClickListener() {
|
|
||||||
|
/*mMessageView.setOnDownloadButtonClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
onDownloadRemainder();
|
onDownloadRemainder();
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
|
mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadMessageFromDatabaseFailed() {
|
private void onLoadMessageFromDatabaseFailed() {
|
||||||
mMessageView.showStatusMessage(mContext.getString(R.string.status_invalid_id_error));
|
// mMessageView.showStatusMessage(mContext.getString(R.string.status_invalid_id_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startDownloadingMessageBody(LocalMessage message) {
|
private void startDownloadingMessageBody(LocalMessage message) {
|
||||||
@ -247,7 +248,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onDownloadMessageFailed(Throwable t) {
|
private void onDownloadMessageFailed(Throwable t) {
|
||||||
mMessageView.enableDownloadButton();
|
// mMessageView.enableDownloadButton();
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
if (t instanceof IllegalArgumentException) {
|
if (t instanceof IllegalArgumentException) {
|
||||||
errorMessage = mContext.getString(R.string.status_invalid_id_error);
|
errorMessage = mContext.getString(R.string.status_invalid_id_error);
|
||||||
@ -269,8 +270,8 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
|
|
||||||
private void showMessage(MessageViewInfo messageContainer) {
|
private void showMessage(MessageViewInfo messageContainer) {
|
||||||
try {
|
try {
|
||||||
mMessageView.setMessage(mAccount, messageContainer, mPgpData);
|
mMessageView.setMessage(mAccount, messageContainer);
|
||||||
mMessageView.setShowDownloadButton(mMessage);
|
// mMessageView.setShowDownloadButton(mMessage);
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
Log.e(K9.LOG_TAG, "Error while trying to display message", e);
|
Log.e(K9.LOG_TAG, "Error while trying to display message", e);
|
||||||
}
|
}
|
||||||
@ -406,7 +407,8 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectText() {
|
public void onSelectText() {
|
||||||
mMessageView.beginSelectingText();
|
// FIXME
|
||||||
|
// mMessageView.beginSelectingText();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRefileActivity(int activity) {
|
private void startRefileActivity(int activity) {
|
||||||
@ -418,7 +420,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
startActivityForResult(intent, activity);
|
startActivityForResult(intent, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (resultCode != Activity.RESULT_OK) {
|
if (resultCode != Activity.RESULT_OK) {
|
||||||
@ -487,7 +488,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
|
if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mMessageView.disableDownloadButton();
|
// mMessageView.disableDownloadButton();
|
||||||
|
|
||||||
mController.loadMessageForViewRemote(mAccount, mMessageReference.folderName, mMessageReference.uid,
|
mController.loadMessageForViewRemote(mAccount, mMessageReference.folderName, mMessageReference.uid,
|
||||||
downloadMessageListener);
|
downloadMessageListener);
|
||||||
@ -533,7 +534,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
PgpData data = new PgpData();
|
PgpData data = new PgpData();
|
||||||
data.setDecryptedData(decryptedData);
|
data.setDecryptedData(decryptedData);
|
||||||
data.setSignatureResult(signatureResult);
|
data.setSignatureResult(signatureResult);
|
||||||
mMessageView.setMessage(mAccount, messageViewInfo, data);
|
mMessageView.setMessage(mAccount, messageViewInfo);
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
Log.e(K9.LOG_TAG, "displayMessageBody failed", e);
|
Log.e(K9.LOG_TAG, "displayMessageBody failed", e);
|
||||||
}
|
}
|
||||||
@ -600,7 +601,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void zoom(KeyEvent event) {
|
public void zoom(KeyEvent event) {
|
||||||
mMessageView.zoom(event);
|
// mMessageView.zoom(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -668,11 +669,11 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void disableAttachmentButtons(AttachmentViewInfo attachment) {
|
public void disableAttachmentButtons(AttachmentViewInfo attachment) {
|
||||||
mMessageView.disableAttachmentButtons(attachment);
|
// mMessageView.disableAttachmentButtons(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableAttachmentButtons(AttachmentViewInfo attachment) {
|
public void enableAttachmentButtons(AttachmentViewInfo attachment) {
|
||||||
mMessageView.enableAttachmentButtons(attachment);
|
// mMessageView.enableAttachmentButtons(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runOnMainThread(Runnable runnable) {
|
public void runOnMainThread(Runnable runnable) {
|
||||||
@ -680,7 +681,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showAttachmentLoadingDialog() {
|
public void showAttachmentLoadingDialog() {
|
||||||
mMessageView.disableAttachmentButtons();
|
// mMessageView.disableAttachmentButtons();
|
||||||
showDialog(R.id.dialog_attachment_progress);
|
showDialog(R.id.dialog_attachment_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,13 +690,13 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
removeDialog(R.id.dialog_attachment_progress);
|
removeDialog(R.id.dialog_attachment_progress);
|
||||||
mMessageView.enableAttachmentButtons();
|
// mMessageView.enableAttachmentButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAttachmentThumbnail(AttachmentViewInfo attachment) {
|
public void refreshAttachmentThumbnail(AttachmentViewInfo attachment) {
|
||||||
mMessageView.refreshAttachmentThumbnail(attachment);
|
// mMessageView.refreshAttachmentThumbnail(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MessageViewFragmentListener {
|
public interface MessageViewFragmentListener {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.fsck.k9.ui.messageview.SingleMessageView
|
<com.fsck.k9.ui.messageview.MessageTopView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/message_view"
|
android:id="@+id/message_view"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@ -19,43 +19,13 @@
|
|||||||
|
|
||||||
<!-- Header area -->
|
<!-- Header area -->
|
||||||
<include layout="@layout/message_view_header"/>
|
<include layout="@layout/message_view_header"/>
|
||||||
|
|
||||||
<!-- Content area -->
|
<LinearLayout
|
||||||
<com.fsck.k9.view.MessageWebView
|
android:orientation="vertical"
|
||||||
android:id="@+id/message_content"
|
android:id="@+id/message_containers"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent"/>
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<!-- Attachments area -->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/attachments_container"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/attachments"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="4dip" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/show_hidden_attachments"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/message_view_show_more_attachments_action"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/hidden_attachments"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="4dip"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.fsck.k9.view.NonLockingScrollView>
|
</com.fsck.k9.view.NonLockingScrollView>
|
||||||
@ -66,4 +36,4 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="fill_parent"/>
|
android:layout_width="fill_parent"/>
|
||||||
|
|
||||||
</com.fsck.k9.ui.messageview.SingleMessageView>
|
</com.fsck.k9.ui.messageview.MessageTopView>
|
||||||
|
43
k9mail/src/main/res/layout/message_container.xml
Normal file
43
k9mail/src/main/res/layout/message_container.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.fsck.k9.ui.messageview.MessageContainerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- Content area -->
|
||||||
|
<com.fsck.k9.view.MessageWebView
|
||||||
|
android:id="@+id/message_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"/>
|
||||||
|
|
||||||
|
<!-- Attachments area -->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/attachments_container"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/attachments"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="4dip" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/show_hidden_attachments"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/message_view_show_more_attachments_action"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/hidden_attachments"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="4dip"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.fsck.k9.ui.messageview.MessageContainerView>
|
Loading…
Reference in New Issue
Block a user