Skip to content

Allow jumping to previous/next page with horizontal swipe gesture#603

Open
ggtlvkma356 wants to merge 2 commits intoGrapheneOS:mainfrom
ggtlvkma356:add-swipe-gesture
Open

Allow jumping to previous/next page with horizontal swipe gesture#603
ggtlvkma356 wants to merge 2 commits intoGrapheneOS:mainfrom
ggtlvkma356:add-swipe-gesture

Conversation

@ggtlvkma356
Copy link
Copy Markdown

This is an improved version of #383, which lacks edge detection, in which case page will change regardless if we are in the middle of a page or at its edge.

The swipe is horizontal only.

closes #41.

Comment on lines +466 to +468
float screenDensity = getResources().getDisplayMetrics().density;
int swipeThreshold = (int) (SWIPE_THRESHOLD * screenDensity);
int swipeVelocityThreshold = (int) (SWIPE_VELOCITY_THRESHOLD * screenDensity);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should precompute swipeThreshold and swipeVelocityThreshold instead of calculating it every fling

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to precomputed, also now the thresholds use system-defined values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gesture-based navigation

2 participants