diff options
| author | Selim Gurun <sgurun@google.com> | 2014-03-14 16:52:45 -0700 |
|---|---|---|
| committer | Selim Gurun <sgurun@google.com> | 2014-03-17 10:06:42 -0700 |
| commit | 23a1af6f83bb51478689020890582f500c73e6ba (patch) | |
| tree | a34509d8fffe8ae5778ffacd93b95471853f012c /core/java/android/webkit/WebView.java | |
| parent | 8959ad36c465d9f91279c0a9f98df4958c0a47ea (diff) | |
| download | frameworks_base-23a1af6f83bb51478689020890582f500c73e6ba.zip frameworks_base-23a1af6f83bb51478689020890582f500c73e6ba.tar.gz frameworks_base-23a1af6f83bb51478689020890582f500c73e6ba.tar.bz2 | |
Provide an API to set print document name.
Bug: 13250097
The current print api for Webview does not allow setting the
print document name, so all documents show up using a hardcoded
name (which is visible to the user). Deprecate the current API
and provide a new one that allows setting the document name.
Change-Id: I7043b78e98f25bbc0e0ef33e1d6d3b0d34401e48
Diffstat (limited to 'core/java/android/webkit/WebView.java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 81d36a4..f1c26e3 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1135,9 +1135,18 @@ public class WebView extends AbsoluteLayout } /** + * @deprecated Use {@link #createPrintDocumentAdapter(String)} which requires user + * to provide a print document name. + */ + @Deprecated + public PrintDocumentAdapter createPrintDocumentAdapter() { + checkThread(); + if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter"); + return mProvider.createPrintDocumentAdapter("default"); + } + + /** * Creates a PrintDocumentAdapter that provides the content of this Webview for printing. - * Only supported for API levels - * {@link android.os.Build.VERSION_CODES#KITKAT} and above. * * The adapter works by converting the Webview contents to a PDF stream. The Webview cannot * be drawn during the conversion process - any such draws are undefined. It is recommended @@ -1145,11 +1154,14 @@ public class WebView extends AbsoluteLayout * temporarily hide a visible WebView by using a custom PrintDocumentAdapter instance * wrapped around the object returned and observing the onStart and onFinish methods. See * {@link android.print.PrintDocumentAdapter} for more information. + * + * @param documentName The user-facing name of the printed document. See + * {@link android.print.PrintDocumentInfo} */ - public PrintDocumentAdapter createPrintDocumentAdapter() { + public PrintDocumentAdapter createPrintDocumentAdapter(String documentName) { checkThread(); if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter"); - return mProvider.createPrintDocumentAdapter(); + return mProvider.createPrintDocumentAdapter(documentName); } /** |
