use of com.android.printspooler.model.PageContentRepository.PageContentProvider in project platform_frameworks_base by android.
the class PageAdapter method recyclePageView.
private void recyclePageView(PageContentView page, int pageIndexInAdapter) {
PageContentProvider provider = page.getPageContentProvider();
if (provider != null) {
page.init(null, mEmptyState, mErrorState, mMediaSize, mMinMargins);
mPageContentRepository.releasePageContentProvider(provider);
}
mBoundPagesInAdapter.remove(pageIndexInAdapter);
page.setTag(null);
}
use of com.android.printspooler.model.PageContentRepository.PageContentProvider in project android_frameworks_base by ResurrectionRemix.
the class PageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding holder: " + holder + " with id: " + getItemId(position) + " for position: " + position);
}
MyViewHolder myHolder = (MyViewHolder) holder;
PreviewPageFrame page = (PreviewPageFrame) holder.itemView;
page.setOnClickListener(mPageClickListener);
page.setTag(holder);
myHolder.mPageInAdapter = position;
final int pageInDocument = computePageIndexInDocument(position);
final int pageIndexInFile = computePageIndexInFile(pageInDocument);
PageContentView content = (PageContentView) page.findViewById(R.id.page_content);
LayoutParams params = content.getLayoutParams();
params.width = mPageContentWidth;
params.height = mPageContentHeight;
PageContentProvider provider = content.getPageContentProvider();
if (pageIndexInFile != INVALID_PAGE_INDEX) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding provider:" + " pageIndexInAdapter: " + position + ", pageInDocument: " + pageInDocument + ", pageIndexInFile: " + pageIndexInFile);
}
provider = mPageContentRepository.acquirePageContentProvider(pageIndexInFile, content);
mBoundPagesInAdapter.put(position, null);
} else {
onSelectedPageNotInFile(pageInDocument);
}
content.init(provider, mEmptyState, mErrorState, mMediaSize, mMinMargins);
if (mConfirmedPagesInDocument.indexOfKey(pageInDocument) >= 0) {
page.setSelected(true, false);
} else {
page.setSelected(false, false);
}
page.setContentDescription(mContext.getString(R.string.page_description_template, pageInDocument + 1, mDocumentPageCount));
TextView pageNumberView = (TextView) page.findViewById(R.id.page_number);
String text = mContext.getString(R.string.current_page_template, pageInDocument + 1, mDocumentPageCount);
pageNumberView.setText(text);
}
use of com.android.printspooler.model.PageContentRepository.PageContentProvider in project android_frameworks_base by DirtyUnicorns.
the class PageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding holder: " + holder + " with id: " + getItemId(position) + " for position: " + position);
}
MyViewHolder myHolder = (MyViewHolder) holder;
PreviewPageFrame page = (PreviewPageFrame) holder.itemView;
page.setOnClickListener(mPageClickListener);
page.setTag(holder);
myHolder.mPageInAdapter = position;
final int pageInDocument = computePageIndexInDocument(position);
final int pageIndexInFile = computePageIndexInFile(pageInDocument);
PageContentView content = (PageContentView) page.findViewById(R.id.page_content);
LayoutParams params = content.getLayoutParams();
params.width = mPageContentWidth;
params.height = mPageContentHeight;
PageContentProvider provider = content.getPageContentProvider();
if (pageIndexInFile != INVALID_PAGE_INDEX) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding provider:" + " pageIndexInAdapter: " + position + ", pageInDocument: " + pageInDocument + ", pageIndexInFile: " + pageIndexInFile);
}
provider = mPageContentRepository.acquirePageContentProvider(pageIndexInFile, content);
mBoundPagesInAdapter.put(position, null);
} else {
onSelectedPageNotInFile(pageInDocument);
}
content.init(provider, mEmptyState, mErrorState, mMediaSize, mMinMargins);
if (mConfirmedPagesInDocument.indexOfKey(pageInDocument) >= 0) {
page.setSelected(true, false);
} else {
page.setSelected(false, false);
}
page.setContentDescription(mContext.getString(R.string.page_description_template, pageInDocument + 1, mDocumentPageCount));
TextView pageNumberView = (TextView) page.findViewById(R.id.page_number);
String text = mContext.getString(R.string.current_page_template, pageInDocument + 1, mDocumentPageCount);
pageNumberView.setText(text);
}
use of com.android.printspooler.model.PageContentRepository.PageContentProvider in project android_frameworks_base by crdroidandroid.
the class PageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding holder: " + holder + " with id: " + getItemId(position) + " for position: " + position);
}
MyViewHolder myHolder = (MyViewHolder) holder;
PreviewPageFrame page = (PreviewPageFrame) holder.itemView;
page.setOnClickListener(mPageClickListener);
page.setTag(holder);
myHolder.mPageInAdapter = position;
final int pageInDocument = computePageIndexInDocument(position);
final int pageIndexInFile = computePageIndexInFile(pageInDocument);
PageContentView content = (PageContentView) page.findViewById(R.id.page_content);
LayoutParams params = content.getLayoutParams();
params.width = mPageContentWidth;
params.height = mPageContentHeight;
PageContentProvider provider = content.getPageContentProvider();
if (pageIndexInFile != INVALID_PAGE_INDEX) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding provider:" + " pageIndexInAdapter: " + position + ", pageInDocument: " + pageInDocument + ", pageIndexInFile: " + pageIndexInFile);
}
provider = mPageContentRepository.acquirePageContentProvider(pageIndexInFile, content);
mBoundPagesInAdapter.put(position, null);
} else {
onSelectedPageNotInFile(pageInDocument);
}
content.init(provider, mEmptyState, mErrorState, mMediaSize, mMinMargins);
if (mConfirmedPagesInDocument.indexOfKey(pageInDocument) >= 0) {
page.setSelected(true, false);
} else {
page.setSelected(false, false);
}
page.setContentDescription(mContext.getString(R.string.page_description_template, pageInDocument + 1, mDocumentPageCount));
TextView pageNumberView = (TextView) page.findViewById(R.id.page_number);
String text = mContext.getString(R.string.current_page_template, pageInDocument + 1, mDocumentPageCount);
pageNumberView.setText(text);
}
use of com.android.printspooler.model.PageContentRepository.PageContentProvider in project android_frameworks_base by AOSPA.
the class PageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding holder: " + holder + " with id: " + getItemId(position) + " for position: " + position);
}
MyViewHolder myHolder = (MyViewHolder) holder;
PreviewPageFrame page = (PreviewPageFrame) holder.itemView;
page.setOnClickListener(mPageClickListener);
page.setTag(holder);
myHolder.mPageInAdapter = position;
final int pageInDocument = computePageIndexInDocument(position);
final int pageIndexInFile = computePageIndexInFile(pageInDocument);
PageContentView content = (PageContentView) page.findViewById(R.id.page_content);
LayoutParams params = content.getLayoutParams();
params.width = mPageContentWidth;
params.height = mPageContentHeight;
PageContentProvider provider = content.getPageContentProvider();
if (pageIndexInFile != INVALID_PAGE_INDEX) {
if (DEBUG) {
Log.i(LOG_TAG, "Binding provider:" + " pageIndexInAdapter: " + position + ", pageInDocument: " + pageInDocument + ", pageIndexInFile: " + pageIndexInFile);
}
provider = mPageContentRepository.acquirePageContentProvider(pageIndexInFile, content);
mBoundPagesInAdapter.put(position, null);
} else {
onSelectedPageNotInFile(pageInDocument);
}
content.init(provider, mEmptyState, mErrorState, mMediaSize, mMinMargins);
if (mConfirmedPagesInDocument.indexOfKey(pageInDocument) >= 0) {
page.setSelected(true, false);
} else {
page.setSelected(false, false);
}
page.setContentDescription(mContext.getString(R.string.page_description_template, pageInDocument + 1, mDocumentPageCount));
TextView pageNumberView = (TextView) page.findViewById(R.id.page_number);
String text = mContext.getString(R.string.current_page_template, pageInDocument + 1, mDocumentPageCount);
pageNumberView.setText(text);
}
Aggregations