Search in sources :

Example 11 with PrintDocumentAdapter

use of android.print.PrintDocumentAdapter in project android by nextcloud.

the class PrintAsyncTask method onPostExecute.

@Override
protected void onPostExecute(Boolean result) {
    RichDocumentsEditorWebView richDocumentsWebView = richDocumentsWebViewWeakReference.get();
    richDocumentsWebView.dismissLoadingDialog();
    PrintManager printManager = (PrintManager) richDocumentsWebView.getSystemService(PRINT_SERVICE);
    if (!result || printManager == null) {
        DisplayUtils.showSnackMessage(richDocumentsWebView, richDocumentsWebView.getString(R.string.failed_to_print));
        return;
    }
    PrintDocumentAdapter printAdapter = new PrintAdapter(file.getAbsolutePath());
    printManager.print(JOB_NAME, printAdapter, new PrintAttributes.Builder().build());
}
Also used : RichDocumentsEditorWebView(com.owncloud.android.ui.activity.RichDocumentsEditorWebView) PrintManager(android.print.PrintManager) PrintDocumentAdapter(android.print.PrintDocumentAdapter) PrintAdapter(com.owncloud.android.ui.adapter.PrintAdapter)

Aggregations

PrintDocumentAdapter (android.print.PrintDocumentAdapter)11 PrintManager (android.print.PrintManager)11 PrintAttributes (android.print.PrintAttributes)4 TargetApi (android.annotation.TargetApi)3 Intent (android.content.Intent)3 PrintJob (android.print.PrintJob)3 Activity (android.app.Activity)2 Bundle (android.os.Bundle)2 CancellationSignal (android.os.CancellationSignal)2 ParcelFileDescriptor (android.os.ParcelFileDescriptor)2 RequiresApi (android.support.annotation.RequiresApi)2 UiDevice (android.support.test.uiautomator.UiDevice)2 UiObject2 (android.support.test.uiautomator.UiObject2)2 LargeTest (androidx.test.filters.LargeTest)2 UUID (java.util.UUID)2 Test (org.junit.Test)2 SuppressLint (android.annotation.SuppressLint)1 WebView (android.webkit.WebView)1 WebViewClient (android.webkit.WebViewClient)1 RichDocumentsEditorWebView (com.owncloud.android.ui.activity.RichDocumentsEditorWebView)1