mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Updates to the view need to happen on the UI thread
Fixes downloading attachments (would just fail silently) Also added a ProgressDialog since progress() just asks for progress to displayed in the title bar. Since there is no title bar, no progress is shown at all.
This commit is contained in:
parent
ea590cbe39
commit
41378188f9
@ -2,5 +2,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<item type="id" name="dialog_confirm_delete"/>
|
<item type="id" name="dialog_confirm_delete"/>
|
||||||
|
<item type="id" name="dialog_attachment_progress"/>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1021,6 +1021,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
<string name="dialog_confirm_delete_confirm_button">Delete</string>
|
<string name="dialog_confirm_delete_confirm_button">Delete</string>
|
||||||
<string name="dialog_confirm_delete_cancel_button">Do not delete</string>
|
<string name="dialog_confirm_delete_cancel_button">Do not delete</string>
|
||||||
|
|
||||||
|
<string name="dialog_attachment_progress_title">Downloading attachment</string>
|
||||||
|
|
||||||
<string name="debug_logging_enabled">Debug logging to Android logging system enabled</string>
|
<string name="debug_logging_enabled">Debug logging to Android logging system enabled</string>
|
||||||
|
|
||||||
<string name="messagelist_sent_to_me_sigil">»</string>
|
<string name="messagelist_sent_to_me_sigil">»</string>
|
||||||
|
@ -2,6 +2,7 @@ package com.fsck.k9.activity;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -942,9 +943,12 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
protected Dialog onCreateDialog(final int id) {
|
protected Dialog onCreateDialog(final int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.dialog_confirm_delete: {
|
case R.id.dialog_confirm_delete: return createConfirmDeleteDialog(id);
|
||||||
return createConfirmDeleteDialog(id);
|
case R.id.dialog_attachment_progress:
|
||||||
}
|
ProgressDialog d = new ProgressDialog(this);
|
||||||
|
d.setIndeterminate(true);
|
||||||
|
d.setTitle(R.string.dialog_attachment_progress_title);
|
||||||
|
return d;
|
||||||
}
|
}
|
||||||
return super.onCreateDialog(id);
|
return super.onCreateDialog(id);
|
||||||
}
|
}
|
||||||
@ -1075,24 +1079,31 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttachmentStarted(Account account, Message message, Part part, Object tag, boolean requiresDownload) {
|
public void loadAttachmentStarted(Account account, Message message, Part part, Object tag, final boolean requiresDownload) {
|
||||||
if (mMessage != message) {
|
if (mMessage != message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
mMessageView.setAttachmentsEnabled(false);
|
mMessageView.setAttachmentsEnabled(false);
|
||||||
mHandler.progress(true);
|
showDialog(R.id.dialog_attachment_progress);
|
||||||
if (requiresDownload) {
|
if (requiresDownload) {
|
||||||
mHandler.fetchingAttachment();
|
mHandler.fetchingAttachment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttachmentFinished(Account account, Message message, Part part, Object tag) {
|
public void loadAttachmentFinished(Account account, Message message, Part part, final Object tag) {
|
||||||
if (mMessage != message) {
|
if (mMessage != message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
mMessageView.setAttachmentsEnabled(true);
|
mMessageView.setAttachmentsEnabled(true);
|
||||||
mHandler.progress(false);
|
removeDialog(R.id.dialog_attachment_progress);
|
||||||
Object[] params = (Object[]) tag;
|
Object[] params = (Object[]) tag;
|
||||||
boolean download = (Boolean) params[0];
|
boolean download = (Boolean) params[0];
|
||||||
AttachmentView attachment = (AttachmentView) params[1];
|
AttachmentView attachment = (AttachmentView) params[1];
|
||||||
@ -1101,6 +1112,9 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
} else {
|
} else {
|
||||||
attachment.showFile();
|
attachment.showFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1108,9 +1122,14 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
if (mMessage != message) {
|
if (mMessage != message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
mMessageView.setAttachmentsEnabled(true);
|
mMessageView.setAttachmentsEnabled(true);
|
||||||
mHandler.progress(false);
|
removeDialog(R.id.dialog_attachment_progress);
|
||||||
mHandler.networkError();
|
mHandler.networkError();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user