Android Open Source - RadaeePDF-B4A Reader Controller






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.reader;
//w w w.  j  av a2s.  c o  m
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Hide;

import com.radaee.pdf.Document;
import com.radaee.view.PDFView;
import com.radaee.view.PDFView.PDFViewListener;
import com.radaee.view.PDFViewDual;


@Hide
public class ReaderController extends View
{
    private PDFView m_pdv;
    private BA ba;
    private String eventName;
    
    public ReaderController(Context context, BA ba, String EventName)
    {
        super(context);
        this.ba = ba;
        this.eventName = EventName;
    }

    public ReaderController(Context context, PDFView pdfView, BA ba, String EventName)
    {
        super(context);
        m_pdv = pdfView;
        this.ba = ba;
        this.eventName = EventName;
    }

    public ReaderController(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    protected void onDraw(Canvas canvas)
    {
        //m_pdv.vDraw(canvas);
        BA.Log("--------In on draw. eventName: " + eventName);
        
        if (ba.subExists(eventName + "_draw")==true) {
          BA.Log("--------Calling draw method in B4A");
      ba.raiseEvent(this, eventName + "_draw", new Object[] { canvas } );
    }
        // Paint paint = new Paint();
        // paint.setARGB(255, 255, 0, 0);
        // canvas.drawText("myText", 20, 20, paint);
    }

    public void open(Document doc, PDFViewListener listener)
    {
        m_pdv = new PDFViewDual(getContext());
        m_pdv.vOpen(doc, 4, 0xFFCCCCCC, listener);
        //boolean paras[] = new boolean[doc.GetPageCount()];
        //((PDFViewDual)m_pdv).vSetLayoutPara(null, paras, false);
        invalidate();
    }
    
    public PDFView getPDFView() {
      return this.m_pdv;
    }
    
    /**
     * Invalidates the view.
     */
    public void invalidate4() {
      invalidate();
    }
    
    @Override
    protected void onSizeChanged (int w, int h, int oldw, int oldh)
    {
//        m_save_w = w;
//        m_save_h = h;
//        if( m_pdv != null && !m_lock_resize )
//            m_pdv.vResize(w, h);
        
        BA.Log("--------In on size changed.");
        
        if (ba.subExists(eventName + "_sizechanged")==true) {
      ba.raiseEvent(this, eventName + "_sizechanged", new Object[] { w, h, oldw, oldh } );
    }
    }

    @Override
  public boolean onTouchEvent(MotionEvent event)
    {
//      if( m_pdv != null )
//        return m_pdv.vTouchEvent(event);
//      else
//        return true;
      
      BA.Log("--------In touch event.");
        boolean yesno=true;
        if (ba.subExists(eventName + "_touchevent")==true) {
      yesno = (Boolean) ba.raiseEvent(this, eventName + "_touchevent", new Object[] { event } );
    }
        return yesno;
    }
    
    @Override
  public void computeScroll()
  {
//    if( m_pdv == null ) return;
//    m_pdv.vComputeScroll();
      
      BA.Log("--------In compute scroll");
        
        if (ba.subExists(eventName + "_computescroll")==true) {
      ba.raiseEvent(this, eventName + "_computescroll" );
    }
  }
   


}




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