Search in sources :

Example 1 with PreviewPageFrame

use of com.android.printspooler.widget.PreviewPageFrame 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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView) PreviewPageFrame(com.android.printspooler.widget.PreviewPageFrame) PageContentProvider(com.android.printspooler.model.PageContentRepository.PageContentProvider) PageContentView(com.android.printspooler.widget.PageContentView)

Example 2 with PreviewPageFrame

use of com.android.printspooler.widget.PreviewPageFrame 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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView) PreviewPageFrame(com.android.printspooler.widget.PreviewPageFrame) PageContentProvider(com.android.printspooler.model.PageContentRepository.PageContentProvider) PageContentView(com.android.printspooler.widget.PageContentView)

Example 3 with PreviewPageFrame

use of com.android.printspooler.widget.PreviewPageFrame 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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView) PreviewPageFrame(com.android.printspooler.widget.PreviewPageFrame) PageContentProvider(com.android.printspooler.model.PageContentRepository.PageContentProvider) PageContentView(com.android.printspooler.widget.PageContentView)

Example 4 with PreviewPageFrame

use of com.android.printspooler.widget.PreviewPageFrame 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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView) PreviewPageFrame(com.android.printspooler.widget.PreviewPageFrame) PageContentProvider(com.android.printspooler.model.PageContentRepository.PageContentProvider) PageContentView(com.android.printspooler.widget.PageContentView)

Example 5 with PreviewPageFrame

use of com.android.printspooler.widget.PreviewPageFrame 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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView) PreviewPageFrame(com.android.printspooler.widget.PreviewPageFrame) PageContentProvider(com.android.printspooler.model.PageContentRepository.PageContentProvider) PageContentView(com.android.printspooler.widget.PageContentView)

Aggregations

LayoutParams (android.view.ViewGroup.LayoutParams)5 TextView (android.widget.TextView)5 PageContentProvider (com.android.printspooler.model.PageContentRepository.PageContentProvider)5 PageContentView (com.android.printspooler.widget.PageContentView)5 PreviewPageFrame (com.android.printspooler.widget.PreviewPageFrame)5