Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49b223e2 authored by Bao-Long Nguyen-Trong's avatar Bao-Long Nguyen-Trong
Browse files

Fixed issue 140 and issue 950: for partially downloaded messages, displaying...

Fixed issue 140 and issue 950: for partially downloaded messages, displaying what we already have while downloading the full message in the background
TODO: Need better icon indicating that the message is being fetched
parent 6f064e11
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -33,6 +33,14 @@
            android:layout_height="22dip"
            android:layout_toRightOf="@id/from"
            android:layout_alignTop="@id/from" />
        <View
            android:id="@+id/downloading"
            android:background="@drawable/ic_menu_reverse_sort"
            android:layout_width="22dip"
            android:layout_height="22dip"
            android:layout_toRightOf="@id/attachment"
            android:layout_alignTop="@id/attachment"
            android:visibility="gone" />
        <LinearLayout
            android:id="@+id/to_container"
            android:layout_width="fill_parent"
+5 −2
Original line number Diff line number Diff line
@@ -2807,9 +2807,12 @@ public class MessagingController implements Runnable
                    if (!message.isSet(Flag.X_DOWNLOADED_FULL))
                    {
                        loadMessageForViewRemote(account, folder, uid, listener);
                        if (!message.isSet(Flag.X_DOWNLOADED_PARTIAL))
                        {
                            localFolder.close();
                            return;
                        }
                    }

                    FetchProfile fp = new FetchProfile();
                    fp.add(FetchProfile.Item.ENVELOPE);
+22 −3
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public class MessageView extends K9Activity
    private WebView mMessageContentView;
    private LinearLayout mAttachments;
    private View mAttachmentIcon;
    private View mDownloadingIcon;
    private View mShowPicturesSection;
    View next;
    View next_scrolling;
@@ -263,6 +264,7 @@ public class MessageView extends K9Activity
            final   String to,
            final   String cc,
            final   boolean hasAttachments,
            final   boolean isDownloading,
            final   boolean flagged,
            final   boolean answered)
        {
@@ -286,6 +288,7 @@ public class MessageView extends K9Activity
                    mToView.setText(to);
                    mCcView.setText(cc);
                    mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
                    mDownloadingIcon.setVisibility(isDownloading ? View.VISIBLE : View.GONE);
                    if (flagged)
                    {
                        mFlagged.setChecked(true);
@@ -460,6 +463,7 @@ public class MessageView extends K9Activity

        mAttachments = (LinearLayout)findViewById(R.id.attachments);
        mAttachmentIcon = findViewById(R.id.attachment);
        mDownloadingIcon = findViewById(R.id.downloading);
        mShowPicturesSection = findViewById(R.id.show_pictures_section);


@@ -1361,6 +1365,7 @@ public class MessageView extends K9Activity
        String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
        String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
        boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
        boolean isDownloading = message.isSet(Flag.X_DOWNLOADED_PARTIAL);
        mHandler.setHeaders(subjectText,
                            fromText,
                            dateText,
@@ -1368,6 +1373,7 @@ public class MessageView extends K9Activity
                            toText,
                            ccText,
                            hasAttachments,
                            isDownloading,
                            message.isSet(Flag.FLAGGED),
                            message.isSet(Flag.ANSWERED));
    }
@@ -1385,7 +1391,8 @@ public class MessageView extends K9Activity
            }

            MessageView.this.mMessage = message;
            if (!message.isSet(Flag.X_DOWNLOADED_FULL))
            if (!message.isSet(Flag.X_DOWNLOADED_FULL)
                && !message.isSet(Flag.X_DOWNLOADED_PARTIAL))
            {
                mHandler.post(new Runnable()
                {
@@ -1417,9 +1424,18 @@ public class MessageView extends K9Activity
                return;
            }

            MessageView.this.mMessage = message;
            try
            {
                if (MessageView.this.mMessage!=null
                    && MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)
                    && message.isSet(Flag.X_DOWNLOADED_FULL))
                {

                    setHeaders(account, folder, uid, message);
                }

                MessageView.this.mMessage = message;

                String text;
                Part part = MimeUtility.findFirstPartByMimeType(mMessage, "text/html");
                if (part == null)
@@ -1508,8 +1524,11 @@ public class MessageView extends K9Activity
                    {
                        mHandler.networkError();
                    }
                    if (!MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
                    {
                        mMessageContentView.loadUrl("file:///android_asset/empty.html");
                    }
                }
            });
        }