mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 06:08:25 -05:00
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
This commit is contained in:
parent
6f064e1193
commit
49b223e20c
@ -33,6 +33,14 @@
|
|||||||
android:layout_height="22dip"
|
android:layout_height="22dip"
|
||||||
android:layout_toRightOf="@id/from"
|
android:layout_toRightOf="@id/from"
|
||||||
android:layout_alignTop="@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
|
<LinearLayout
|
||||||
android:id="@+id/to_container"
|
android:id="@+id/to_container"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -2807,8 +2807,11 @@ public class MessagingController implements Runnable
|
|||||||
if (!message.isSet(Flag.X_DOWNLOADED_FULL))
|
if (!message.isSet(Flag.X_DOWNLOADED_FULL))
|
||||||
{
|
{
|
||||||
loadMessageForViewRemote(account, folder, uid, listener);
|
loadMessageForViewRemote(account, folder, uid, listener);
|
||||||
localFolder.close();
|
if (!message.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
||||||
return;
|
{
|
||||||
|
localFolder.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchProfile fp = new FetchProfile();
|
FetchProfile fp = new FetchProfile();
|
||||||
|
@ -70,6 +70,7 @@ public class MessageView extends K9Activity
|
|||||||
private WebView mMessageContentView;
|
private WebView mMessageContentView;
|
||||||
private LinearLayout mAttachments;
|
private LinearLayout mAttachments;
|
||||||
private View mAttachmentIcon;
|
private View mAttachmentIcon;
|
||||||
|
private View mDownloadingIcon;
|
||||||
private View mShowPicturesSection;
|
private View mShowPicturesSection;
|
||||||
View next;
|
View next;
|
||||||
View next_scrolling;
|
View next_scrolling;
|
||||||
@ -263,6 +264,7 @@ public class MessageView extends K9Activity
|
|||||||
final String to,
|
final String to,
|
||||||
final String cc,
|
final String cc,
|
||||||
final boolean hasAttachments,
|
final boolean hasAttachments,
|
||||||
|
final boolean isDownloading,
|
||||||
final boolean flagged,
|
final boolean flagged,
|
||||||
final boolean answered)
|
final boolean answered)
|
||||||
{
|
{
|
||||||
@ -286,6 +288,7 @@ public class MessageView extends K9Activity
|
|||||||
mToView.setText(to);
|
mToView.setText(to);
|
||||||
mCcView.setText(cc);
|
mCcView.setText(cc);
|
||||||
mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
|
mAttachmentIcon.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
|
||||||
|
mDownloadingIcon.setVisibility(isDownloading ? View.VISIBLE : View.GONE);
|
||||||
if (flagged)
|
if (flagged)
|
||||||
{
|
{
|
||||||
mFlagged.setChecked(true);
|
mFlagged.setChecked(true);
|
||||||
@ -460,6 +463,7 @@ public class MessageView extends K9Activity
|
|||||||
|
|
||||||
mAttachments = (LinearLayout)findViewById(R.id.attachments);
|
mAttachments = (LinearLayout)findViewById(R.id.attachments);
|
||||||
mAttachmentIcon = findViewById(R.id.attachment);
|
mAttachmentIcon = findViewById(R.id.attachment);
|
||||||
|
mDownloadingIcon = findViewById(R.id.downloading);
|
||||||
mShowPicturesSection = findViewById(R.id.show_pictures_section);
|
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 toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
|
||||||
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
|
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
|
||||||
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
|
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
|
||||||
|
boolean isDownloading = message.isSet(Flag.X_DOWNLOADED_PARTIAL);
|
||||||
mHandler.setHeaders(subjectText,
|
mHandler.setHeaders(subjectText,
|
||||||
fromText,
|
fromText,
|
||||||
dateText,
|
dateText,
|
||||||
@ -1368,6 +1373,7 @@ public class MessageView extends K9Activity
|
|||||||
toText,
|
toText,
|
||||||
ccText,
|
ccText,
|
||||||
hasAttachments,
|
hasAttachments,
|
||||||
|
isDownloading,
|
||||||
message.isSet(Flag.FLAGGED),
|
message.isSet(Flag.FLAGGED),
|
||||||
message.isSet(Flag.ANSWERED));
|
message.isSet(Flag.ANSWERED));
|
||||||
}
|
}
|
||||||
@ -1385,7 +1391,8 @@ public class MessageView extends K9Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageView.this.mMessage = message;
|
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()
|
mHandler.post(new Runnable()
|
||||||
{
|
{
|
||||||
@ -1417,9 +1424,18 @@ public class MessageView extends K9Activity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageView.this.mMessage = message;
|
|
||||||
try
|
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;
|
String text;
|
||||||
Part part = MimeUtility.findFirstPartByMimeType(mMessage, "text/html");
|
Part part = MimeUtility.findFirstPartByMimeType(mMessage, "text/html");
|
||||||
if (part == null)
|
if (part == null)
|
||||||
@ -1508,7 +1524,10 @@ public class MessageView extends K9Activity
|
|||||||
{
|
{
|
||||||
mHandler.networkError();
|
mHandler.networkError();
|
||||||
}
|
}
|
||||||
mMessageContentView.loadUrl("file:///android_asset/empty.html");
|
if (!MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
||||||
|
{
|
||||||
|
mMessageContentView.loadUrl("file:///android_asset/empty.html");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user