Example usage for android.graphics.pdf PdfRenderer.Page close

List of usage examples for android.graphics.pdf PdfRenderer.Page close

Introduction

In this page you can find the example usage for android.graphics.pdf PdfRenderer.Page close.

Prototype

public void close() 

Source Link

Document

Closes this renderer.

Usage

From source file:es.voghdev.pdfviewpager.library.adapter.LegacyPDFPagerAdapter.java

@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
    View v = inflater.inflate(R.layout.view_zoomable_pdf_page, container, false);
    ImageViewTouch ivt = (ImageViewTouch) v.findViewById(R.id.imageViewZoom);

    if (renderer == null || getCount() < position)
        return v;

    PdfRenderer.Page page = getPDFPage(renderer, position);

    Bitmap bitmap = bitmapContainer.get(position);
    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    page.close();

    ivt.setImageBitmap(bitmap);//from   w w  w. j a v a2  s .c  o m
    ((ViewPager) container).addView(v, 0);

    return v;
}

From source file:com.franctan.pdfviewpager.library.adapter.PDFPagerAdapter.java

protected void initBitmapPool() {

    PdfRenderer.Page samplePage = getPDFPage(0);
    width = (int) (samplePage.getWidth() * mRenderQuality);
    height = (int) (samplePage.getHeight() * mRenderQuality);
    samplePage.close();

    mBitmapPool = new SimpleBitmapPool(mOffScreenSize, width, height, Bitmap.Config.ARGB_8888);

}

From source file:com.franctan.pdfviewpager.library.adapter.PDFPagerAdapter.java

@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
    View v = inflater.inflate(R.layout.view_pdf_page, container, false);
    ImageView iv = (ImageView) v.findViewById(R.id.imageView);

    if (renderer == null || getCount() < position) {
        return v;
    }/*  w w w.ja  v  a2s.c o  m*/

    PdfRenderer.Page page = getPDFPage(position);

    Bitmap bitmap = mBitmapPool.getBitmap(position);

    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    page.close();

    iv.setImageBitmap(bitmap);
    ((ViewPager) container).addView(v, 0);

    return v;
}

From source file:com.epubtest.hxfy.epubtest.BasePDFPagerAdapter.java

@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
    View v = inflater.inflate(R.layout.view_pdf_page, container, false);
    ImageView iv = (ImageView) v.findViewById(R.id.imageView);

    if (renderer == null || getCount() < position) {
        return v;
    }/*  w w w  .j a v a 2  s .  co  m*/

    PdfRenderer.Page page = getPDFPage(renderer, position);

    Bitmap bitmap = bitmapContainer.get(position);
    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    page.close();

    iv.setImageBitmap(bitmap);
    container.addView(v, 0);

    return v;
}

From source file:com.justwayward.reader.view.pdfview.PDFPagerAdapter.java

@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
    View v = inflater.inflate(R.layout.view_pdf_page, container, false);
    ImageView iv = (ImageView) v.findViewById(R.id.imageView);

    if (renderer == null || getCount() < position) {
        return v;
    }//w  w  w.  j a v a 2s .  c  o  m

    PdfRenderer.Page page = getPDFPage(renderer, position);

    Bitmap bitmap = bitmapContainer.get(position);
    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    page.close();

    PhotoViewAttacher attacher = new PhotoViewAttacher(iv);
    attacher.setScale(scale.getScale(), scale.getCenterX(), scale.getCenterY(), true);
    attacher.setOnMatrixChangeListener(this);

    attachers.put(position, new WeakReference<PhotoViewAttacher>(attacher));

    iv.setImageBitmap(bitmap);
    attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            pageClickListener.onClick(view);
        }
    });
    attacher.update();
    ((ViewPager) container).addView(v, 0);

    return v;
}

From source file:es.voghdev.pdfviewpager.library.adapter.BasePDFPagerAdapter.java

@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
    View v = inflater.inflate(R.layout.view_pdf_page, container, false);
    ImageView iv = (ImageView) v.findViewById(R.id.imageView);

    if (renderer == null || getCount() < position) {
        return v;
    }/*from  w  w  w . j a va2  s .co  m*/

    PdfRenderer.Page page = getPDFPage(renderer, position);

    Bitmap bitmap = bitmapContainer.get(position);
    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    page.close();

    iv.setImageBitmap(bitmap);
    ((ViewPager) container).addView(v, 0);

    return v;
}

From source file:com.epubtest.hxfy.epubtest.BasePDFPagerAdapter.java

@SuppressWarnings("NewApi")
private PdfRendererParams extractPdfParamsFromFirstPage(PdfRenderer renderer, float renderQuality) {
    PdfRenderer.Page samplePage = getPDFPage(renderer, FIRST_PAGE);
    PdfRendererParams params = new PdfRendererParams();

    params.setRenderQuality(renderQuality);
    params.setOffScreenSize(offScreenSize);
    params.setWidth((int) (samplePage.getWidth() * renderQuality));
    params.setHeight((int) (samplePage.getHeight() * renderQuality));

    samplePage.close();

    return params;
}