Search in sources :

Example 6 with RemotePrintDocumentInfo

use of com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo in project android_frameworks_base by ResurrectionRemix.

the class PrintActivity method updatePrintPreviewController.

private void updatePrintPreviewController(boolean contentUpdated) {
    // If we have not heard from the application, do nothing.
    RemotePrintDocumentInfo documentInfo = mPrintedDocument.getDocumentInfo();
    if (!documentInfo.laidout) {
        return;
    }
    // Update the preview controller.
    mPrintPreviewController.onContentUpdated(contentUpdated, getAdjustedPageCount(documentInfo.info), mPrintedDocument.getDocumentInfo().writtenPages, mSelectedPages, mPrintJob.getAttributes().getMediaSize(), mPrintJob.getAttributes().getMinMargins());
}
Also used : RemotePrintDocumentInfo(com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo)

Example 7 with RemotePrintDocumentInfo

use of com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class PrintActivity method updatePrintPreviewController.

private void updatePrintPreviewController(boolean contentUpdated) {
    // If we have not heard from the application, do nothing.
    RemotePrintDocumentInfo documentInfo = mPrintedDocument.getDocumentInfo();
    if (!documentInfo.laidout) {
        return;
    }
    // Update the preview controller.
    mPrintPreviewController.onContentUpdated(contentUpdated, getAdjustedPageCount(documentInfo.info), mPrintedDocument.getDocumentInfo().writtenPages, mSelectedPages, mPrintJob.getAttributes().getMediaSize(), mPrintJob.getAttributes().getMinMargins());
}
Also used : RemotePrintDocumentInfo(com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo)

Example 8 with RemotePrintDocumentInfo

use of com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class PrintActivity method onUpdateCompleted.

@Override
public void onUpdateCompleted(RemotePrintDocumentInfo document) {
    if (DEBUG) {
        Log.i(LOG_TAG, "onUpdateCompleted()");
    }
    setState(mProgressMessageController.cancel());
    ensurePreviewUiShown();
    // Update the print job with the info for the written document. The page
    // count we get from the remote document is the pages in the document from
    // the app perspective but the print job should contain the page count from
    // print service perspective which is the pages in the written PDF not the
    // pages in the printed document.
    PrintDocumentInfo info = document.info;
    if (info != null) {
        final int pageCount = PageRangeUtils.getNormalizedPageCount(document.writtenPages, getAdjustedPageCount(info));
        PrintDocumentInfo adjustedInfo = new PrintDocumentInfo.Builder(info.getName()).setContentType(info.getContentType()).setPageCount(pageCount).build();
        File file = mFileProvider.acquireFile(null);
        try {
            adjustedInfo.setDataSize(file.length());
        } finally {
            mFileProvider.releaseFile();
        }
        mPrintJob.setDocumentInfo(adjustedInfo);
        mPrintJob.setPages(document.printedPages);
    }
    switch(mState) {
        case STATE_PRINT_CONFIRMED:
            {
                requestCreatePdfFileOrFinish();
            }
            break;
        case STATE_CREATE_FILE_FAILED:
        case STATE_PRINT_COMPLETED:
        case STATE_PRINT_CANCELED:
            {
                updateOptionsUi();
                doFinish();
            }
            break;
        default:
            {
                updatePrintPreviewController(document.changed);
                setState(STATE_CONFIGURING);
                updateOptionsUi();
            }
            break;
    }
}
Also used : RemotePrintDocumentInfo(com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo) PrintDocumentInfo(android.print.PrintDocumentInfo) File(java.io.File)

Example 9 with RemotePrintDocumentInfo

use of com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo in project android_frameworks_base by crdroidandroid.

the class PrintActivity method updatePrintPreviewController.

private void updatePrintPreviewController(boolean contentUpdated) {
    // If we have not heard from the application, do nothing.
    RemotePrintDocumentInfo documentInfo = mPrintedDocument.getDocumentInfo();
    if (!documentInfo.laidout) {
        return;
    }
    // Update the preview controller.
    mPrintPreviewController.onContentUpdated(contentUpdated, getAdjustedPageCount(documentInfo.info), mPrintedDocument.getDocumentInfo().writtenPages, mSelectedPages, mPrintJob.getAttributes().getMediaSize(), mPrintJob.getAttributes().getMinMargins());
}
Also used : RemotePrintDocumentInfo(com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo)

Example 10 with RemotePrintDocumentInfo

use of com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo in project android_frameworks_base by crdroidandroid.

the class PrintActivity method onUpdateCompleted.

@Override
public void onUpdateCompleted(RemotePrintDocumentInfo document) {
    if (DEBUG) {
        Log.i(LOG_TAG, "onUpdateCompleted()");
    }
    setState(mProgressMessageController.cancel());
    ensurePreviewUiShown();
    // Update the print job with the info for the written document. The page
    // count we get from the remote document is the pages in the document from
    // the app perspective but the print job should contain the page count from
    // print service perspective which is the pages in the written PDF not the
    // pages in the printed document.
    PrintDocumentInfo info = document.info;
    if (info != null) {
        final int pageCount = PageRangeUtils.getNormalizedPageCount(document.writtenPages, getAdjustedPageCount(info));
        PrintDocumentInfo adjustedInfo = new PrintDocumentInfo.Builder(info.getName()).setContentType(info.getContentType()).setPageCount(pageCount).build();
        File file = mFileProvider.acquireFile(null);
        try {
            adjustedInfo.setDataSize(file.length());
        } finally {
            mFileProvider.releaseFile();
        }
        mPrintJob.setDocumentInfo(adjustedInfo);
        mPrintJob.setPages(document.printedPages);
    }
    switch(mState) {
        case STATE_PRINT_CONFIRMED:
            {
                requestCreatePdfFileOrFinish();
            }
            break;
        case STATE_CREATE_FILE_FAILED:
        case STATE_PRINT_COMPLETED:
        case STATE_PRINT_CANCELED:
            {
                updateOptionsUi();
                doFinish();
            }
            break;
        default:
            {
                updatePrintPreviewController(document.changed);
                setState(STATE_CONFIGURING);
                updateOptionsUi();
            }
            break;
    }
}
Also used : RemotePrintDocumentInfo(com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo) PrintDocumentInfo(android.print.PrintDocumentInfo) File(java.io.File)

Aggregations

RemotePrintDocumentInfo (com.android.printspooler.model.RemotePrintDocument.RemotePrintDocumentInfo)10 PrintDocumentInfo (android.print.PrintDocumentInfo)5 File (java.io.File)5