summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/ScrollerHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/ui/ScrollerHelper.java')
-rw-r--r--src/com/android/gallery3d/ui/ScrollerHelper.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/ui/ScrollerHelper.java b/src/com/android/gallery3d/ui/ScrollerHelper.java
index 9f19cec96..84235185b 100644
--- a/src/com/android/gallery3d/ui/ScrollerHelper.java
+++ b/src/com/android/gallery3d/ui/ScrollerHelper.java
@@ -58,6 +58,10 @@ public class ScrollerHelper {
return mScroller.getCurrX();
}
+ public float getCurrVelocity() {
+ return mScroller.getCurrVelocity();
+ }
+
public void setPosition(int position) {
mScroller.startScroll(
position, 0, // startX, startY
@@ -77,7 +81,8 @@ public class ScrollerHelper {
mOverflingEnabled ? mOverflingDistance : 0, 0);
}
- public boolean startScroll(int distance, int min, int max) {
+ // Returns the distance that over the scroll limit.
+ public int startScroll(int distance, int min, int max) {
int currPosition = mScroller.getCurrX();
int finalPosition = mScroller.getFinalX();
int newPosition = Utils.clamp(finalPosition + distance, min, max);
@@ -85,9 +90,7 @@ public class ScrollerHelper {
mScroller.startScroll(
currPosition, 0, // startX, startY
newPosition - currPosition, 0, 0); // dx, dy, duration
- return true;
- } else {
- return false;
}
+ return finalPosition + distance - newPosition;
}
}