Disable swipe gesture on Android - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Disable swipe gesture on Android

Disable swipe gesture on Android 3 months 2 weeks ago #13301

  • Verducci
  • Verducci's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi!
I want show my pdf and change page ONLY using buttons how i can disable pdf swipe gesture?
Thank you!

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

Disable swipe gesture on Android 3 months 2 weeks ago #13303

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 789
  • Karma: 20
  • Thank you received: 58
It depends on the view mode, for single/dual view mode, you can achieve that by modifying PDFLayoutView.onTouchNone and PDFGestureListener.onFling as follows:
private boolean onTouchNone(MotionEvent event)
	{....
case MotionEvent.ACTION_MOVE:
            if(m_hold && m_layout.vGetScale() > m_layout.vGetMinScale()) {
                m_layout.vSetX((int) (m_hold_docx + m_hold_x - event.getX()));
                m_layout.vSetY((int) (m_hold_docy + m_hold_y - event.getY()));
                invalidate();
            }
			break;
		case MotionEvent.ACTION_UP:
		case MotionEvent.ACTION_CANCEL:
            if(m_hold && m_layout.vGetScale() > m_layout.vGetMinScale()) {....
class PDFGestureListener extends GestureDetector.SimpleOnGestureListener
    {
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
        {
			if(m_layout == null) return false;
        	if(m_status == STA_NONE && m_hold && m_layout.vGetScale() > m_layout.vGetMinScale())
        	{....
This will block the scroll and fling while the page is not zoomed.
If you need to block the page change while zoomed, please check Avoid page change during navigation while zoomed (Android)

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

  • Page:
  • 1
Powered by Kunena Forum