Print single message and offscreen webview.
b/10712542.
Also supports Eml printing and secure printing (though
that's email only and has some buggy rendering).
Also fixes the no subject crash. b/11136365
Change-Id: Ie5f6e7d7e1762c115df3169b6e62dc439545f08c
diff --git a/src/com/android/mail/ui/ConversationViewFragment.java b/src/com/android/mail/ui/ConversationViewFragment.java
index 63ade39..e42b6e6 100644
--- a/src/com/android/mail/ui/ConversationViewFragment.java
+++ b/src/com/android/mail/ui/ConversationViewFragment.java
@@ -27,9 +27,6 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
-import android.print.PrintAttributes;
-import android.print.PrintJob;
-import android.print.PrintManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.ScaleGestureDetector;
@@ -67,7 +64,7 @@
import com.android.mail.browse.WebViewContextMenu;
import com.android.mail.content.ObjectCursor;
import com.android.mail.preferences.AccountPreferences;
-import com.android.mail.print.Printer;
+import com.android.mail.print.PrintUtils;
import com.android.mail.providers.Account;
import com.android.mail.providers.Address;
import com.android.mail.providers.Conversation;
@@ -1580,17 +1577,7 @@
}
protected void printConversation() {
- // TODO - offscreen webview stuff so that we don't clobber
- final String convHtml =
- Printer.print(getContext(), mAccount, getMessageCursor(),
- mAddressCache, true /* userJavascript */);
- mWebView.getSettings().setBlockNetworkImage(false);
- mWebView.loadDataWithBaseURL(
- mConversation.getBaseUri(mBaseUri), convHtml, "text/html", "utf-8", null);
- final PrintManager printManager =
- (PrintManager) getContext().getSystemService(Context.PRINT_SERVICE);
- printManager.print(mConversation.subject,
- mWebView.createPrintDocumentAdapter(),
- new PrintAttributes.Builder().build());
+ PrintUtils.printConversation(getContext(), getMessageCursor(), mAddressCache,
+ mConversation.getBaseUri(mBaseUri), true /* useJavascript */);
}
}