am 20b7ca91: Fix bug with snapping during scrolling
* commit '20b7ca91b277e9668b6d4b4b3c9116b6778d22a5': Fix bug with snapping during scrolling
This commit is contained in:
@@ -1270,7 +1270,7 @@ public abstract class PagedView extends ViewGroup {
|
|||||||
// snap duration. This is a function of the actual distance that needs to be traveled;
|
// snap duration. This is a function of the actual distance that needs to be traveled;
|
||||||
// we keep this value close to half screen size in order to reduce the variance in snap
|
// we keep this value close to half screen size in order to reduce the variance in snap
|
||||||
// duration as a function of the distance the page needs to travel.
|
// duration as a function of the distance the page needs to travel.
|
||||||
float distanceRatio = 1.0f * Math.abs(delta) / 2 * halfScreenSize;
|
float distanceRatio = Math.min(1f, 1.0f * Math.abs(delta) / (2 * halfScreenSize));
|
||||||
float distance = halfScreenSize + halfScreenSize *
|
float distance = halfScreenSize + halfScreenSize *
|
||||||
distanceInfluenceForSnapDuration(distanceRatio);
|
distanceInfluenceForSnapDuration(distanceRatio);
|
||||||
|
|
||||||
@@ -1279,8 +1279,8 @@ public abstract class PagedView extends ViewGroup {
|
|||||||
|
|
||||||
// we want the page's snap velocity to approximately match the velocity at which the
|
// we want the page's snap velocity to approximately match the velocity at which the
|
||||||
// user flings, so we scale the duration by a value near to the derivative of the scroll
|
// user flings, so we scale the duration by a value near to the derivative of the scroll
|
||||||
// interpolator at zero, ie. 5. We use 6 to make it a little slower.
|
// interpolator at zero, ie. 5. We use 4 to make it a little slower.
|
||||||
duration = 6 * Math.round(1000 * Math.abs(distance / velocity));
|
duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
|
||||||
|
|
||||||
snapToPage(whichPage, delta, duration);
|
snapToPage(whichPage, delta, duration);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user