-
-
Notifications
You must be signed in to change notification settings - Fork 107
Added in swipe gestures to navigate pages #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…lling. Reading a file while zoomed in does not cause unnecessary page changes.
While this is still pending, I will continue to test this build and fix any other issues with the implementation. |
731a863
to
0d0cf10
Compare
be232f1
to
799b483
Compare
fbe15bf
to
99736fc
Compare
This seems to be aiming at the same thing as #282, and both are in the queue for a while. What needs to happen for either of them to be merged? More testing? Anything else? Moving between pages using gestures would be a great UX enhancement (for me, anyway). |
Yes, when I started this I didn’t realise that there was another PR doing the same thing. I would like to see this merged but I haven’t heard anything more on it. I think it needs some work to get it up to scratch with the rest of the code and would like that help. |
@thestinger or maybe @octocorvus (as a GOS member who had a recent-ish PR here), I'd appreciate a comment. I'm willing to help out to make this one happen, but let's clarify the blockers. @Madmatt88 could you please update the PR in the meanwhile, to trigger checks and see which ones are failing? The logs for the previous update are already gone. |
It needs to be implemented as swiping between pages, not a gesture across the screen that's always there. |
@thestinger Thank you for that piece of information, I will have a look and change the implementation to fit that requirement. @alt3r-3go I will rebase the PR and re-trigger the action to find the build error. After that I'll start to make the changes to fit the new requirements and then update the PR, if I have any major issues I will reach out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments, hopefully helpful. I'd also suggest taking a look at the other PR on this, as it seems to have pieces worth merging here.
@@ -24,9 +32,20 @@ static void attach(Context context, View gestureView, GestureListener listener) | |||
final GestureDetector detector = new GestureDetector(context, | |||
new GestureDetector.SimpleOnGestureListener() { | |||
@Override | |||
public boolean onSingleTapUp(MotionEvent motionEvent) { | |||
public boolean onSingleTapUp(@NonNull MotionEvent motionEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated to the PR topic, I'd suggest removing, to avoid polluting git history.
boolean onFling(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float velocityX, float velocityY); | ||
boolean onDown(); | ||
// Can be replaced with ratio when supported | ||
void onZoomIn(float value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why would this and the next one are needed, given it's not about zooming?
public void onZoom(float scaleFactor, float focusX, float focusY) { | ||
zoom(scaleFactor, focusX, focusY, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace-only changes like this are usually discouraged, or at least should be split out to dedicated commits.
float deltaY = e2.getY() - e1.getY(); | ||
|
||
if (Math.abs(deltaX) > Math.abs(deltaY)){ | ||
if ((deltaX > 0) & (Math.abs(velocityX) > maxXVelocity)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitwise & operator used instead of the boolean one.
if ((deltaX > 0) & (Math.abs(velocityX) > maxXVelocity)) { | ||
Log.d("Horizontal", "Right movement Position"); | ||
onJumpToPageInDocument(mPage - 1); | ||
} else if ((Math.abs(velocityX) > maxXVelocity)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest moving this condition over to the higher-level if
clause, to simplify and avoid repeating it.
} | ||
|
||
@Override | ||
public boolean onDown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one really necessary?
Address issue #41 and adds the feature of being able to use swipe gestures to navigate the pages of a PDF.