Android Open Source - RadaeePDF-B4A P D F Thumb View






From Project

Back to project page RadaeePDF-B4A.

License

The source code is released under:

Apache License

If you think the Android project RadaeePDF-B4A listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.radaee.util;
/*from   w w w. j a  va  2 s . c o m*/
import com.radaee.pdf.Document;
import com.radaee.pdf.Page;
import com.radaee.view.PDFView.PDFPos;
import com.radaee.view.PDFView.PDFViewListener;
import com.radaee.view.PDFVPage;
import com.radaee.view.PDFViewThumb;
import com.radaee.view.PDFViewThumb.PDFThumbListener;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class PDFThumbView extends View implements PDFViewListener
{
  private PDFViewThumb m_thumb;
  public PDFThumbView(Context context, AttributeSet attrs)
  {
    super(context, attrs);
    m_thumb = new PDFViewThumb(context);
  }
  public void OnPDFPosChanged(PDFPos pos)
  {
  }
  public boolean OnPDFDoubleTapped(float x, float y)
  {
    return false;
  }
  public boolean OnPDFSingleTapped(float x, float y)
  {
    return false;
  }
  public void OnPDFLongPressed(float x, float y)
  {
  }
  public void OnPDFShowPressed(float x, float y)
  {
  }
  public void OnPDFSelectEnd()
  {
  }
  public void OnPDFFound(boolean found)
  {
  }
  public void OnPDFInvalidate(boolean post)
  {
    if( post ) postInvalidate();
    else invalidate();
  }
  @Override
  public void computeScroll()
  {
    if( m_thumb != null )
      m_thumb.vComputeScroll();
  }
  @Override
  protected void onDraw(Canvas canvas)
  {
    if( m_thumb != null )
      m_thumb.vDraw(canvas);
  }
  @Override
  protected void onSizeChanged( int w, int h, int oldw, int oldh )
  {
    if( m_thumb != null )
      m_thumb.vResize(w, h);
  }
  @Override
  public boolean onTouchEvent(MotionEvent event)
  {
    if( m_thumb == null ) return false;
    return m_thumb.vTouchEvent(event);
  }
  public void thumbOpen( Document doc, PDFThumbListener listener )
  {
    //m_thumb.vSetOrientation(2);//RTOL horizontal layout
    m_thumb.vOpen(doc, 8, 0x40CCCCCC, this);
    m_thumb.vSetThumbListener(listener);
    m_thumb.vResize(getWidth(), getHeight());
  }
  public void thumbClose()
  {
    m_thumb.vClose();
  }
  /**
   * set selected page and goto the page
   * @param pageno
   */
  public void thumbGotoPage( int pageno )
  {
    m_thumb.vSetSel(pageno);
  }
  /**
   * render a page again, after page is edited.
   * @param pageno
   */
  public void thumbUpdatePage( int pageno )
  {
    m_thumb.vRender(m_thumb.vGetPage(pageno));
  }
  private Paint m_paint = new Paint();
  public void OnPDFPageDisplayed(Canvas canvas, PDFVPage vpage)
  {
    m_paint.setColor(0x800000FF);
    int top = vpage.GetVY(m_thumb.vGetY());
    int bottom = top + vpage.GetHeight();
    int left = vpage.GetVX(m_thumb.vGetX());
    int right = left + vpage.GetWidth();
    if( m_thumb.vGetOrientation() == 1 )//vertical
      m_paint.setTextSize(m_thumb.vGetWinW() / 5);
    else
      m_paint.setTextSize(m_thumb.vGetWinH() / 5);
    m_paint.setTextAlign(Align.CENTER);
    canvas.drawText(String.valueOf(vpage.GetPageNo() + 1),
        (left + right)/2, (top + bottom)/2, m_paint);
  }
  public void OnPDFSelecting(Canvas canvas, int[] rect1, int[] rect2) {
    // TODO Auto-generated method stub
    
  }
}




Java Source Code List

com.example.pdfhttpdemo.MainActivity.java
com.example.pdfhttpdemo.ReaderController.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.BMDatabase.java
com.radaee.pdf.Document.java
com.radaee.pdf.Document.java
com.radaee.pdf.Document.java
com.radaee.pdf.Global.java
com.radaee.pdf.Global.java
com.radaee.pdf.Global.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.HWriting.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Ink.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.Matrix.java
com.radaee.pdf.PDFHttpStream.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.PageContent.java
com.radaee.pdf.Page.java
com.radaee.pdf.Page.java
com.radaee.pdf.Page.java
com.radaee.pdf.Path.java
com.radaee.pdf.Path.java
com.radaee.pdf.Path.java
com.radaee.reader.PDFCropAct.java
com.radaee.reader.PDFCrop.java
com.radaee.reader.PDFEncAct.java
com.radaee.reader.PDFInkAct.java
com.radaee.reader.PDFInk.java
com.radaee.reader.PDFReaderAct.java
com.radaee.reader.PDFReaderOldAct.java
com.radaee.reader.PDFReaderOld.java
com.radaee.reader.PDFReader.java
com.radaee.reader.PDFSimpleAct.java
com.radaee.reader.PDFSimple.java
com.radaee.reader.PDFTestAct.java
com.radaee.reader.ReaderActivity.java
com.radaee.reader.ReaderController.java
com.radaee.reader.ReaderController.java
com.radaee.util.ComboListAdt.java
com.radaee.util.ComboList.java
com.radaee.util.PDFAESEnc.java
com.radaee.util.PDFAESEnc.java
com.radaee.util.PDFAESStream.java
com.radaee.util.PDFAESStream.java
com.radaee.util.PDFAssetStream.java
com.radaee.util.PDFAssetStream.java
com.radaee.util.PDFFileStream.java
com.radaee.util.PDFFileStream.java
com.radaee.util.PDFGridAdt.java
com.radaee.util.PDFGridItem.java
com.radaee.util.PDFGridThread.java
com.radaee.util.PDFGridView.java
com.radaee.util.PDFHttpStream.java
com.radaee.util.PDFHttpStream.java
com.radaee.util.PDFMemStream.java
com.radaee.util.PDFMemStream.java
com.radaee.util.PDFThumbView.java
com.radaee.util.SnatchAdt.java
com.radaee.util.SnatchView.java
com.rootsoft.pdfviewer.main.java
com.rootsoft.pdfviewer.readercontroller.java
com.rootsoft.rspdfviewer.pdf.RSPDFAnnotation.java
com.rootsoft.rspdfviewer.pdf.RSPDFBMDatabase.java
com.rootsoft.rspdfviewer.pdf.RSPDFDocument.java
com.rootsoft.rspdfviewer.pdf.RSPDFGlobal.java
com.rootsoft.rspdfviewer.pdf.RSPDFHWriting.java
com.rootsoft.rspdfviewer.pdf.RSPDFInk.java
com.rootsoft.rspdfviewer.pdf.RSPDFMatrix.java
com.rootsoft.rspdfviewer.pdf.RSPDFPageContent.java
com.rootsoft.rspdfviewer.pdf.RSPDFPage.java
com.rootsoft.rspdfviewer.pdf.RSPDFPath.java
com.rootsoft.rspdfviewer.pdf.RSPDFTemplate.java
com.rootsoft.rspdfviewer.pdf.RSPDFVPage.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewCurl.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewDual.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewHorz.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewThumb.java
com.rootsoft.rspdfviewer.pdf.RSPDFViewVert.java
com.rootsoft.rspdfviewer.pdf.RSPDFView.java
com.rootsoft.rspdfviewer.pdf.RSReaderView.java