From ae51a3397b7b5fd1cbd0b7b01d7783d7cb7f9068 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 14 Oct 2020 15:44:32 +0200 Subject: [PATCH] Print improvements --- .../main/java/eu/faircode/email/FragmentMessages.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 4188021e8c..c93d36009b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -50,6 +50,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.print.PrintAttributes; import android.print.PrintDocumentAdapter; +import android.print.PrintJob; import android.print.PrintManager; import android.provider.ContactsContract; import android.provider.Settings; @@ -266,6 +267,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private BoundaryCallbackMessages.SearchCriteria criteria = null; private boolean pane; + private WebView printWebView = null; + private long message = -1; private OpenPgpServiceConnection pgpService; @@ -7028,8 +7031,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private void onPrint(Bundle args) { new SimpleTask() { - private WebView printWebView = null; - @Override protected String[] onExecute(Context context, Bundle args) throws IOException { long id = args.getLong("id"); @@ -7186,9 +7187,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. Log.i("Print queue job=" + jobName); PrintDocumentAdapter adapter = printWebView.createPrintDocumentAdapter(jobName); - printManager.print(jobName, adapter, new PrintAttributes.Builder().build()); + PrintJob job = printManager.print(jobName, adapter, new PrintAttributes.Builder().build()); + Log.i("Print queued job=" + job.getInfo()); } catch (Throwable ex) { - Log.e(ex); + Log.unexpectedError(getParentFragmentManager(), ex); } finally { printWebView = null; }