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());
}
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());
}
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;
}
}
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());
}
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;
}
}
Aggregations