Commit 901f1a08 authored by Hussein's avatar Hussein

Merge branch 'P4A-930' into release/v1.1.200

parents 5a272587 15877fdf
......@@ -5,6 +5,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -89,6 +91,7 @@ public class MessageLoaderHelper {
private OpenPgpDecryptionResult cachedDecryptionResult;
private MessageCryptoHelper messageCryptoHelper;
private Handler handler = new Handler(Looper.getMainLooper());
public MessageLoaderHelper(Context context, LoaderManager loaderManager, FragmentManager fragmentManager,
......@@ -441,20 +444,21 @@ public class MessageLoaderHelper {
MessagingListener downloadMessageListener = new SimpleMessagingListener() {
@Override
public void loadMessageRemoteFinished(Account account, String folder, String uid) {
if (!messageReference.equals(account.getUuid(), folder, uid)) {
return;
}
onMessageDownloadFinished();
public void loadMessageRemoteFinished(final Account account, final String folder, final String uid) {
handler.post(() -> {
if (!messageReference.equals(account.getUuid(), folder, uid)) {
return;
}
onMessageDownloadFinished();
});
}
@Override
public void loadMessageRemoteFailed(Account account, String folder, String uid, final Throwable t) {
onDownloadMessageFailed(t);
handler.post(() -> onDownloadMessageFailed(t));
}
};
// callback interface
public interface MessageLoaderCallbacks {
......
......@@ -895,14 +895,20 @@ public class MessageViewFragment extends PEpFragment implements ConfirmationDial
@Override
public void onDownloadErrorMessageNotFound() {
mMessageView.enableDownloadButton();
getActivity().runOnUiThread(() -> FeedbackTools.showLongFeedback(getView(), getString(R.string.status_invalid_id_error)));
runOnMainThread(() -> {
mMessageView.enableDownloadButton();
FeedbackTools.showLongFeedback(getView(), getString(R.string.status_invalid_id_error));
}
);
}
@Override
public void onDownloadErrorNetworkError() {
mMessageView.enableDownloadButton();
getActivity().runOnUiThread(() -> FeedbackTools.showLongFeedback(getView(), getString(R.string.status_network_error)));
runOnMainThread(() -> {
mMessageView.enableDownloadButton();
FeedbackTools.showLongFeedback(getView(), getString(R.string.status_network_error));
}
);
}
@Override
......@@ -1006,13 +1012,14 @@ public class MessageViewFragment extends PEpFragment implements ConfirmationDial
@Override
public void onViewAttachment(AttachmentViewInfo attachment) {
//TODO: check if we have to download the attachment first
currentAttachmentViewInfo = attachment;
getAttachmentController(attachment).viewAttachment();
}
@Override
public void onSaveAttachment(AttachmentViewInfo attachment) {
//TODO: check if we have to download the attachment first
currentAttachmentViewInfo = attachment;
createPermissionListeners();
if (permissionChecker.hasWriteExternalPermission()) {
getAttachmentController(attachment).saveAttachment();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment