Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

onDoubleTapEvent not working on GLView 2 years 7 months ago #15627

  • thiagopelikan
  • thiagopelikan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
Hi, I'm trying to update my lib to the new version (RadaeePDF AndroidStudio 3.60.3) but the double tap event is not working. I removed the comments after "//remove comment mark to enable zoom when double tap.".
I tried to remove the comments in PDFSample code too, but it has the same behaviour. It looks like another page is getting the zoom,.After I double tap, I got another page selected with zoom.

Is there any workaround for it?

        @Override
        public boolean onDoubleTapEvent(MotionEvent e) {
            if (m_status == STA_NONE && e.getActionMasked() == MotionEvent.ACTION_UP) {
                final int x = (int)e.getX();
                final int y = (int)e.getY();
                final float z = m_layout.vGetZoom();
                final GLLayout.PDFPos pos = m_layout.vGetPos(x, y);
                queueEvent(new Runnable() {
                    @Override
                    public void run() {
                        m_layout.gl_zoom_start(m_gl10);
                        m_layout.gl_zoom_set(z * 1.2f);
                        m_layout.vSetPos(x, y, pos);
                        m_layout.gl_zoom_confirm(m_gl10);
                        requestRender();
                    }
                });
                //float x = e.getX();
                //float y = e.getY();
                int pageno = (m_layout != null) ? m_layout.vGetPage((int)x, (int)y) : -1;
                if (m_listener == null || !m_listener.OnPDFDoubleTapped(pageno, x, y))
                    return false;
                return true;
            }
            return false;
        }

Tks,
Thiago

Please Log in or Create an account to join the conversation.

Last edit: by thiagopelikan. Reason: Adding Code

onDoubleTapEvent not working on GLView 2 years 7 months ago #15628

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
you should change codes like:
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
if (m_status == STA_NONE && e.getActionMasked() == MotionEvent.ACTION_UP) {
final int x = (int)e.getX();
final int y = (int)e.getY();

//remove comment mark to enable zoom when double tap.
final float z = m_layout.vGetZoom();
final GLLayout.PDFPos pos = m_layout.vGetPos(x, y);
queueEvent(new Runnable() {
@Override
public void run() {
m_layout.gl_zoom_start(m_gl10);
m_layout.gl_zoom_set(z * 1.2f);
m_layout.vSetPos(x, y, pos);
m_layout.gl_zoom_confirm(m_gl10);
requestRender();
}
});

//int pageno = (m_layout != null) ? m_layout.vGetPage((int)x, (int)y) : -1;
//if (m_listener == null || !m_listener.OnPDFDoubleTapped(pageno, x, y))
// return false;
return true;
}
return false;
}

because
if (m_listener == null || !m_listener.OnPDFDoubleTapped(pageno, x, y))
    return false;
return false will make double tap works in wrong way.
The following user(s) said Thank You: thiagopelikan

Please Log in or Create an account to join the conversation.

Last edit: by radaee.

onDoubleTapEvent not working on GLView 2 years 7 months ago #15629

  • thiagopelikan
  • thiagopelikan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
Yes!!! Tks a lot!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum