Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

onDoubleTapEvent not working on GLView

More
IP: 177.194.84.112 4 years 6 months ago - 4 years 6 months ago #15627 by thiagopelikan
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
Last edit: 4 years 6 months ago by thiagopelikan. Reason: Adding Code
More
IP: 111.196.242.56 4 years 6 months ago - 4 years 6 months ago #15628 by radaee
you should change codes like:
Code:
@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
Code:
if (m_listener == null || !m_listener.OnPDFDoubleTapped(pageno, x, y)) return false;
return false will make double tap works in wrong way.
Last edit: 4 years 6 months ago by radaee.
More
IP: 177.194.84.112 4 years 6 months ago #15629 by thiagopelikan
Yes!!! Tks a lot!
Time to create page: 0.388 seconds
Powered by Kunena Forum