vSetX/vSetY don't work unless flinging first - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
01 Jun 2018
During last few days we're experiencing some delay in website stmp provider channel.
Some notification email from the website might not reaching containers.
We're working on a definitive solution.
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: vSetX/vSetY don't work unless flinging first

vSetX/vSetY don't work unless flinging first 2 weeks 4 days ago #13943

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 23
  • Thank you received: 0
My app has several ways to programmatically scroll through documents, such as page up/down hotspots placed over the document. These call PDFSetX/PDFSetY methods that I've added to PDFLayoutView, which in turn call vSetPos in PDFLayout, which calls vSetX/vSetY in PDFLayout. vSetX/vSetY calls m_scroller.setFinalX/setFinalY.

However, on my Pixel C tablet running Android 8.1, setFinalX/setFinalY doesn't do anything unless the document has previously been flung, which calls PDFLayout.vFling. I think this is because the fling method sets a velocity in the scroller, which can be used by later calls to setFinalX/setFinalY. If setFinalX/setFinalY are called without flinging, the velocity is 0 and nothing happens.

I have replaced setFinalX/setFinalY with this code in my PDFLayout:

int startX = vGetX();
int startY = vGetY();
int distanceX = Math.round(x - startX);
int distanceY = 0;
m_scroller.startScroll(startX, startY, distanceX, distanceY);

int startX = vGetX();
int startY = vGetY();
int distanceX = 0;
int distanceY = Math.round(y - startY);
m_scroller.startScroll(startX, startY, distanceX, distanceY);

This is working for me. But maybe there is a better way to do it? And maybe you should make this change in a future release of PDFLayout?

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

vSetX/vSetY don't work unless flinging first 2 weeks 3 days ago #13951

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 847
  • Karma: 22
  • Thank you received: 66
Thanks for the feedback, we will evaluate it and if necessary we will add it.

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

  • Page:
  • 1
Powered by Kunena Forum