Fields Summary |
---|
private final PrintActivity | mActivity |
private final com.android.printspooler.model.MutexFileProvider | mFileProvider |
private final MyHandler | mHandler |
private final PageAdapter | mPageAdapter |
private final android.support.v7.widget.GridLayoutManager | mLayoutManger |
private final com.android.printspooler.widget.PrintOptionsLayout | mPrintOptionsLayout |
private final android.support.v7.widget.RecyclerView | mRecyclerView |
private final com.android.printspooler.widget.PrintContentView | mContentView |
private final com.android.printspooler.widget.EmbeddedContentContainer | mEmbeddedContentContainer |
private final PreloadController | mPreloadController |
private int | mDocumentPageCount |
Methods Summary |
---|
public void | closeOptions()
mContentView.closeOptions();
|
public void | destroy(java.lang.Runnable callback)
mHandler.cancelQueuedOperations();
mRecyclerView.setAdapter(null);
mPageAdapter.destroy(callback);
|
public int | getFilePageCount()
return mPageAdapter.getFilePageCount();
|
public int | getHeight()
return mEmbeddedContentContainer.getHeight();
|
public android.print.PageRange[] | getRequestedPages()
return mPageAdapter.getRequestedPages();
|
public android.print.PageRange[] | getSelectedPages()
return mPageAdapter.getSelectedPages();
|
public int | getWidth()
return mEmbeddedContentContainer.getWidth();
|
public boolean | isOptionsOpened()
return mContentView.isOptionsOpened();
|
public void | onContentUpdated(boolean documentChanged, int documentPageCount, android.print.PageRange[] writtenPages, android.print.PageRange[] selectedPages, android.print.PrintAttributes.MediaSize mediaSize, android.print.PrintAttributes.Margins minMargins)
boolean contentChanged = false;
if (documentChanged) {
contentChanged = true;
}
if (documentPageCount != mDocumentPageCount) {
mDocumentPageCount = documentPageCount;
contentChanged = true;
}
if (contentChanged) {
// If not closed, close as we start over.
if (mPageAdapter.isOpened()) {
Message operation = mHandler.obtainMessage(MyHandler.MSG_CLOSE);
mHandler.enqueueOperation(operation);
}
}
// The content changed. In this case we have to invalidate
// all rendered pages and reopen the file...
if ((contentChanged || !mPageAdapter.isOpened()) && writtenPages != null) {
Message operation = mHandler.obtainMessage(MyHandler.MSG_OPEN);
mHandler.enqueueOperation(operation);
}
// Update the attributes before after closed to avoid flicker.
SomeArgs args = SomeArgs.obtain();
args.arg1 = writtenPages;
args.arg2 = selectedPages;
args.arg3 = mediaSize;
args.arg4 = minMargins;
args.argi1 = documentPageCount;
Message operation = mHandler.obtainMessage(MyHandler.MSG_UPDATE, args);
mHandler.enqueueOperation(operation);
// If document changed and has pages we want to start preloading.
if (contentChanged && writtenPages != null) {
operation = mHandler.obtainMessage(MyHandler.MSG_START_PRELOAD);
mHandler.enqueueOperation(operation);
}
|
public void | onOrientationChanged()
// Adjust the print option column count.
final int optionColumnCount = mActivity.getResources().getInteger(
R.integer.print_option_column_count);
mPrintOptionsLayout.setColumnCount(optionColumnCount);
mPageAdapter.onOrientationChanged();
|
public void | onReleaseRequested(java.io.File file)
// This is called from the async task's single threaded executor
// thread, i.e. not on the main thread - so post a message.
mHandler.post(new Runnable() {
@Override
public void run() {
// At this point the other end will write to the file, hence
// we have to close it and reopen after the write completes.
if (mPageAdapter.isOpened()) {
Message operation = mHandler.obtainMessage(MyHandler.MSG_CLOSE);
mHandler.enqueueOperation(operation);
}
}
});
|
public void | onSizeChanged(int width, int height)
mPageAdapter.onPreviewAreaSizeChanged();
|
public void | setColumnCount(int columnCount)
mLayoutManger.setSpanCount(columnCount);
|
public void | setPadding(int left, int top, int right, int bottom)
mRecyclerView.setPadding(left, top, right, bottom);
|
public void | setUiShown(boolean shown)
if (shown) {
mRecyclerView.setVisibility(View.VISIBLE);
} else {
mRecyclerView.setVisibility(View.GONE);
}
|