Handle unsupported message types

This commit is contained in:
Philip Whitehouse 2016-03-23 11:44:50 +00:00
parent 3490da4482
commit 186ed1b72c
3 changed files with 11 additions and 0 deletions

View file

@ -4,13 +4,17 @@ package com.fsck.k9.ui.message;
import android.content.AsyncTaskLoader;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.fsck.k9.K9;
import com.fsck.k9.R;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mailstore.LocalMessageExtractor;
import com.fsck.k9.mailstore.MessageViewInfo;
import com.fsck.k9.ui.crypto.MessageCryptoAnnotations;
import java.util.Collections;
public class DecodeMessageLoader extends AsyncTaskLoader<MessageViewInfo> {
private final Message message;

View file

@ -272,6 +272,12 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
}
private void onDecodeMessageFinished(MessageViewInfo messageViewInfo) {
if(messageViewInfo == null) {
Toast.makeText(getActivity().getApplicationContext(),
R.string.message_view_toast_unable_to_display_message, Toast.LENGTH_SHORT)
.show();
messageViewInfo = new MessageViewInfo(Collections.EMPTY_LIST, mMessage);
}
this.messageViewInfo = messageViewInfo;
showMessage(messageViewInfo);
}

View file

@ -281,6 +281,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="message_view_show_more_attachments_action">More…</string>
<string name="message_view_no_viewer">Unable to find viewer for <xliff:g id="mimetype">%s</xliff:g>.</string>
<string name="message_view_download_remainder">Download complete message</string>
<string name="message_view_toast_unable_to_display_message">Unable to display message</string>
<!-- NOTE: The following message refers to strings with id account_setup_incoming_save_all_headers_label and account_setup_incoming_title -->
<string name="message_no_additional_headers_available">All headers have been downloaded, but there are no additional headers to show.</string>