Print improvements

pull/187/head
M66B 4 years ago
parent c201412882
commit ae51a3397b

@ -50,6 +50,7 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.print.PrintAttributes; import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter; import android.print.PrintDocumentAdapter;
import android.print.PrintJob;
import android.print.PrintManager; import android.print.PrintManager;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.provider.Settings; import android.provider.Settings;
@ -266,6 +267,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private BoundaryCallbackMessages.SearchCriteria criteria = null; private BoundaryCallbackMessages.SearchCriteria criteria = null;
private boolean pane; private boolean pane;
private WebView printWebView = null;
private long message = -1; private long message = -1;
private OpenPgpServiceConnection pgpService; private OpenPgpServiceConnection pgpService;
@ -7028,8 +7031,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onPrint(Bundle args) { private void onPrint(Bundle args) {
new SimpleTask<String[]>() { new SimpleTask<String[]>() {
private WebView printWebView = null;
@Override @Override
protected String[] onExecute(Context context, Bundle args) throws IOException { protected String[] onExecute(Context context, Bundle args) throws IOException {
long id = args.getLong("id"); long id = args.getLong("id");
@ -7186,9 +7187,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Log.i("Print queue job=" + jobName); Log.i("Print queue job=" + jobName);
PrintDocumentAdapter adapter = printWebView.createPrintDocumentAdapter(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) { } catch (Throwable ex) {
Log.e(ex); Log.unexpectedError(getParentFragmentManager(), ex);
} finally { } finally {
printWebView = null; printWebView = null;
} }

Loading…
Cancel
Save