Loading k9mail/src/main/java/com/fsck/k9/ui/compose/QuotedMessageMvpView.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class QuotedMessageMvpView { } public void setQuotedHtml(String quotedContent, AttachmentResolver attachmentResolver) { mQuotedHTML.displayHtmlContentWithInlineAttachments(quotedContent, attachmentResolver); mQuotedHTML.displayHtmlContentWithInlineAttachments(quotedContent, attachmentResolver, null); } public void setQuotedText(String quotedText) { Loading k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java +10 −4 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public class MessageCryptoHelper { private static final int INVALID_OPENPGP_RESULT_CODE = -1; private static final MimeBodyPart NO_REPLACEMENT_PART = null; public static final int REQUEST_CODE_USER_INTERACTION = 124; public static final int PROGRESS_SIZE_THRESHOLD = 4096; private final Context context; Loading Loading @@ -277,7 +278,8 @@ public class MessageCryptoHelper { @Override public void onProgress(int current, int max) { Log.d(K9.LOG_TAG, "got progress: " + current + " / " + max); Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max); callback.onCryptoHelperProgress(current, max); } }); } Loading @@ -297,7 +299,8 @@ public class MessageCryptoHelper { @Override public void onProgress(int current, int max) { Log.d(K9.LOG_TAG, "got progress: " + current + " / " + max); Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max); callback.onCryptoHelperProgress(current, max); } }); } Loading @@ -321,7 +324,7 @@ public class MessageCryptoHelper { private OpenPgpDataSource getDataSourceForEncryptedOrInlineData() throws IOException { return new OpenPgpApi.OpenPgpDataSource() { @Override public Long getTotalDataSize() { public Long getSizeForProgress() { Part part = currentCryptoPart.part; CryptoPartType cryptoPartType = currentCryptoPart.type; Body body; Loading @@ -335,7 +338,10 @@ public class MessageCryptoHelper { throw new IllegalStateException("part to stream must be encrypted or inline!"); } if (body instanceof SizeAware) { return ((SizeAware) body).getSize(); long bodySize = ((SizeAware) body).getSize(); if (bodySize > PROGRESS_SIZE_THRESHOLD) { return bodySize; } } return null; } Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/CryptoInfoDialog.java +3 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,9 @@ public class CryptoInfoDialog extends DialogFragment { } private void setMessageForDisplayStatus(MessageCryptoDisplayStatus displayStatus) { if (displayStatus.textResFirst == null) { throw new AssertionError("Crypto info dialog can only be displayed for items with text!"); } if (displayStatus.textResSecond == null) { setMessageSingleLine(displayStatus.color, displayStatus.textResFirst, displayStatus.iconResFirst, displayStatus.iconResSecond); Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java +21 −6 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.fsck.k9.mailstore.AttachmentViewInfo; import com.fsck.k9.mailstore.MessageViewInfo; import com.fsck.k9.view.MessageHeader.OnLayoutChangedListener; import com.fsck.k9.view.MessageWebView; import com.fsck.k9.view.MessageWebView.OnPageFinishedListener; public class MessageContainerView extends LinearLayout implements OnClickListener, Loading Loading @@ -401,7 +402,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } public void displayMessageViewContainer(MessageViewInfo messageViewInfo, boolean automaticallyLoadPictures, ShowPicturesController showPicturesController, final OnRenderingFinishedListener onRenderingFinishedListener, boolean automaticallyLoadPictures, ShowPicturesController showPicturesController, AttachmentViewCallback attachmentCallback) throws MessagingException { this.attachmentCallback = attachmentCallback; Loading Loading @@ -441,7 +443,15 @@ public class MessageContainerView extends LinearLayout implements OnClickListene textToDisplay = wrapStatusMessage(getContext().getString(R.string.webview_empty_message)); } displayHtmlContentWithInlineAttachments(textToDisplay, messageViewInfo.attachmentResolver); OnPageFinishedListener onPageFinishedListener = new OnPageFinishedListener() { @Override public void onPageFinished() { onRenderingFinishedListener.onLoadFinished(); } }; displayHtmlContentWithInlineAttachments( textToDisplay, messageViewInfo.attachmentResolver, onPageFinishedListener); if (!TextUtils.isEmpty(messageViewInfo.extraText)) { unsignedTextContainer.setVisibility(View.VISIBLE); Loading @@ -453,18 +463,19 @@ public class MessageContainerView extends LinearLayout implements OnClickListene return "<div style=\"text-align:center; color: grey;\">" + status + "</div>"; } private void displayHtmlContentWithInlineAttachments(String htmlText, AttachmentResolver attachmentResolver) { private void displayHtmlContentWithInlineAttachments(String htmlText, AttachmentResolver attachmentResolver, OnPageFinishedListener onPageFinishedListener) { currentHtmlText = htmlText; currentAttachmentResolver = attachmentResolver; mMessageContentView.displayHtmlContentWithInlineAttachments(htmlText, attachmentResolver); mMessageContentView.displayHtmlContentWithInlineAttachments(htmlText, attachmentResolver, onPageFinishedListener); } private void refreshDisplayedContent() { mMessageContentView.displayHtmlContentWithInlineAttachments(currentHtmlText, currentAttachmentResolver); mMessageContentView.displayHtmlContentWithInlineAttachments(currentHtmlText, currentAttachmentResolver, null); } private void clearDisplayedContent() { mMessageContentView.displayHtmlContentWithInlineAttachments("", null); mMessageContentView.displayHtmlContentWithInlineAttachments("", null, null); } public void renderAttachments(MessageViewInfo messageViewInfo) throws MessagingException { Loading Loading @@ -614,4 +625,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene out.writeInt((this.showingPictures) ? 1 : 0); } } interface OnRenderingFinishedListener { void onLoadFinished(); } } k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java +5 −2 Original line number Diff line number Diff line Loading @@ -37,11 +37,14 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { MessageCryptoDisplayStatus displayStatus = MessageCryptoDisplayStatus.fromResultAnnotation(messageViewInfo.cryptoResultAnnotation); switch (displayStatus) { case LOADING: // no need to do anything, there is a progress bar... break; case UNENCRYPTED_SIGN_UNKNOWN: launchPendingIntent(messageViewInfo); break; default: displaySignatureInfoDialog(displayStatus); displayCryptoInfoDialog(displayStatus); break; } } Loading @@ -59,7 +62,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { messageCryptoMvpView.restartMessageCryptoProcessing(); } private void displaySignatureInfoDialog(MessageCryptoDisplayStatus displayStatus) { private void displayCryptoInfoDialog(MessageCryptoDisplayStatus displayStatus) { messageCryptoMvpView.showCryptoInfoDialog(displayStatus); } Loading Loading
k9mail/src/main/java/com/fsck/k9/ui/compose/QuotedMessageMvpView.java +1 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class QuotedMessageMvpView { } public void setQuotedHtml(String quotedContent, AttachmentResolver attachmentResolver) { mQuotedHTML.displayHtmlContentWithInlineAttachments(quotedContent, attachmentResolver); mQuotedHTML.displayHtmlContentWithInlineAttachments(quotedContent, attachmentResolver, null); } public void setQuotedText(String quotedText) { Loading
k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java +10 −4 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public class MessageCryptoHelper { private static final int INVALID_OPENPGP_RESULT_CODE = -1; private static final MimeBodyPart NO_REPLACEMENT_PART = null; public static final int REQUEST_CODE_USER_INTERACTION = 124; public static final int PROGRESS_SIZE_THRESHOLD = 4096; private final Context context; Loading Loading @@ -277,7 +278,8 @@ public class MessageCryptoHelper { @Override public void onProgress(int current, int max) { Log.d(K9.LOG_TAG, "got progress: " + current + " / " + max); Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max); callback.onCryptoHelperProgress(current, max); } }); } Loading @@ -297,7 +299,8 @@ public class MessageCryptoHelper { @Override public void onProgress(int current, int max) { Log.d(K9.LOG_TAG, "got progress: " + current + " / " + max); Log.d(K9.LOG_TAG, "received progress status: " + current + " / " + max); callback.onCryptoHelperProgress(current, max); } }); } Loading @@ -321,7 +324,7 @@ public class MessageCryptoHelper { private OpenPgpDataSource getDataSourceForEncryptedOrInlineData() throws IOException { return new OpenPgpApi.OpenPgpDataSource() { @Override public Long getTotalDataSize() { public Long getSizeForProgress() { Part part = currentCryptoPart.part; CryptoPartType cryptoPartType = currentCryptoPart.type; Body body; Loading @@ -335,7 +338,10 @@ public class MessageCryptoHelper { throw new IllegalStateException("part to stream must be encrypted or inline!"); } if (body instanceof SizeAware) { return ((SizeAware) body).getSize(); long bodySize = ((SizeAware) body).getSize(); if (bodySize > PROGRESS_SIZE_THRESHOLD) { return bodySize; } } return null; } Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/CryptoInfoDialog.java +3 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,9 @@ public class CryptoInfoDialog extends DialogFragment { } private void setMessageForDisplayStatus(MessageCryptoDisplayStatus displayStatus) { if (displayStatus.textResFirst == null) { throw new AssertionError("Crypto info dialog can only be displayed for items with text!"); } if (displayStatus.textResSecond == null) { setMessageSingleLine(displayStatus.color, displayStatus.textResFirst, displayStatus.iconResFirst, displayStatus.iconResSecond); Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java +21 −6 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.fsck.k9.mailstore.AttachmentViewInfo; import com.fsck.k9.mailstore.MessageViewInfo; import com.fsck.k9.view.MessageHeader.OnLayoutChangedListener; import com.fsck.k9.view.MessageWebView; import com.fsck.k9.view.MessageWebView.OnPageFinishedListener; public class MessageContainerView extends LinearLayout implements OnClickListener, Loading Loading @@ -401,7 +402,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } public void displayMessageViewContainer(MessageViewInfo messageViewInfo, boolean automaticallyLoadPictures, ShowPicturesController showPicturesController, final OnRenderingFinishedListener onRenderingFinishedListener, boolean automaticallyLoadPictures, ShowPicturesController showPicturesController, AttachmentViewCallback attachmentCallback) throws MessagingException { this.attachmentCallback = attachmentCallback; Loading Loading @@ -441,7 +443,15 @@ public class MessageContainerView extends LinearLayout implements OnClickListene textToDisplay = wrapStatusMessage(getContext().getString(R.string.webview_empty_message)); } displayHtmlContentWithInlineAttachments(textToDisplay, messageViewInfo.attachmentResolver); OnPageFinishedListener onPageFinishedListener = new OnPageFinishedListener() { @Override public void onPageFinished() { onRenderingFinishedListener.onLoadFinished(); } }; displayHtmlContentWithInlineAttachments( textToDisplay, messageViewInfo.attachmentResolver, onPageFinishedListener); if (!TextUtils.isEmpty(messageViewInfo.extraText)) { unsignedTextContainer.setVisibility(View.VISIBLE); Loading @@ -453,18 +463,19 @@ public class MessageContainerView extends LinearLayout implements OnClickListene return "<div style=\"text-align:center; color: grey;\">" + status + "</div>"; } private void displayHtmlContentWithInlineAttachments(String htmlText, AttachmentResolver attachmentResolver) { private void displayHtmlContentWithInlineAttachments(String htmlText, AttachmentResolver attachmentResolver, OnPageFinishedListener onPageFinishedListener) { currentHtmlText = htmlText; currentAttachmentResolver = attachmentResolver; mMessageContentView.displayHtmlContentWithInlineAttachments(htmlText, attachmentResolver); mMessageContentView.displayHtmlContentWithInlineAttachments(htmlText, attachmentResolver, onPageFinishedListener); } private void refreshDisplayedContent() { mMessageContentView.displayHtmlContentWithInlineAttachments(currentHtmlText, currentAttachmentResolver); mMessageContentView.displayHtmlContentWithInlineAttachments(currentHtmlText, currentAttachmentResolver, null); } private void clearDisplayedContent() { mMessageContentView.displayHtmlContentWithInlineAttachments("", null); mMessageContentView.displayHtmlContentWithInlineAttachments("", null, null); } public void renderAttachments(MessageViewInfo messageViewInfo) throws MessagingException { Loading Loading @@ -614,4 +625,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene out.writeInt((this.showingPictures) ? 1 : 0); } } interface OnRenderingFinishedListener { void onLoadFinished(); } }
k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java +5 −2 Original line number Diff line number Diff line Loading @@ -37,11 +37,14 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { MessageCryptoDisplayStatus displayStatus = MessageCryptoDisplayStatus.fromResultAnnotation(messageViewInfo.cryptoResultAnnotation); switch (displayStatus) { case LOADING: // no need to do anything, there is a progress bar... break; case UNENCRYPTED_SIGN_UNKNOWN: launchPendingIntent(messageViewInfo); break; default: displaySignatureInfoDialog(displayStatus); displayCryptoInfoDialog(displayStatus); break; } } Loading @@ -59,7 +62,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { messageCryptoMvpView.restartMessageCryptoProcessing(); } private void displaySignatureInfoDialog(MessageCryptoDisplayStatus displayStatus) { private void displayCryptoInfoDialog(MessageCryptoDisplayStatus displayStatus) { messageCryptoMvpView.showCryptoInfoDialog(displayStatus); } Loading