use of com.android.printspooler.widget.PageContentView 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);
}
use of com.android.printspooler.widget.PageContentView in project platform_frameworks_base by android.
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.widget.PageContentView in project android_frameworks_base by AOSPA.
the class PageAdapter method onViewRecycled.
@Override
public void onViewRecycled(ViewHolder holder) {
MyViewHolder myHolder = (MyViewHolder) holder;
PageContentView content = (PageContentView) holder.itemView.findViewById(R.id.page_content);
recyclePageView(content, myHolder.mPageInAdapter);
myHolder.mPageInAdapter = INVALID_PAGE_INDEX;
}
use of com.android.printspooler.widget.PageContentView in project android_frameworks_base by ResurrectionRemix.
the class PageAdapter method onViewRecycled.
@Override
public void onViewRecycled(ViewHolder holder) {
MyViewHolder myHolder = (MyViewHolder) holder;
PageContentView content = (PageContentView) holder.itemView.findViewById(R.id.page_content);
recyclePageView(content, myHolder.mPageInAdapter);
myHolder.mPageInAdapter = INVALID_PAGE_INDEX;
}
use of com.android.printspooler.widget.PageContentView in project android_frameworks_base by crdroidandroid.
the class PageAdapter method onViewRecycled.
@Override
public void onViewRecycled(ViewHolder holder) {
MyViewHolder myHolder = (MyViewHolder) holder;
PageContentView content = (PageContentView) holder.itemView.findViewById(R.id.page_content);
recyclePageView(content, myHolder.mPageInAdapter);
myHolder.mPageInAdapter = INVALID_PAGE_INDEX;
}
Aggregations