PagerSnapDistance
-
Cmn
interface PagerSnapDistance
PagerSnapDistance defines the way the Pager will treat the distance between the current page and the page where it will settle.
Summary
Public companion functions |
||
|---|---|---|
PagerSnapDistance |
Limits the maximum number of pages that can be flung per fling gesture. |
Cmn
|
Public functions |
||
|---|---|---|
Int |
calculateTargetPage(Provides a chance to change where the |
Cmn
|
Public companion functions
atMost
fun atMost(pages: Int): PagerSnapDistance
Limits the maximum number of pages that can be flung per fling gesture.
| Parameters | |
|---|---|
pages: Int |
The maximum number of extra pages that can be flung at once. |
Public functions
calculateTargetPage
fun calculateTargetPage(
startPage: Int,
suggestedTargetPage: Int,
velocity: Float,
pageSize: Int,
pageSpacing: Int
): Int
Provides a chance to change where the Pager fling will settle.
| Parameters | |
|---|---|
startPage: Int |
The current page right before the fling starts. |
suggestedTargetPage: Int |
The proposed target page where this fling will stop. This target will be the page that will be correctly positioned (snapped) after naturally decaying with |
velocity: Float |
The initial fling velocity. |
pageSize: Int |
The page size for this |
pageSpacing: Int |
The spacing used between pages in pixels. |
| Returns | |
|---|---|
Int |
An updated target page where to settle. Note that this value needs to be between 0 and the total count of pages in this pager. If an invalid value is passed, the pager will coerce within the valid values. |