diff --git a/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java b/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java index a06cdd7cf..fecb88307 100644 --- a/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java +++ b/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java @@ -242,5 +242,13 @@ public interface IPullToRefresh { * @param showView */ public void setShowViewWhileRefreshing(boolean showView); + + + /** + * Sets the ratio in which we start the release-to-refresh state (e.g. if ratio = 2, only when the + * user pulls the list twice as much, then we'll enter the release-to-refresh state). + * @param ratio the ratio + */ + public void setReleaseRatio(float ratio); } \ No newline at end of file diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java index e76b234f3..043543e62 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java @@ -99,6 +99,10 @@ public abstract class PullToRefreshBase extends LinearLayout imp private SmoothScrollRunnable mCurrentSmoothScrollRunnable; + // At what ratio should we start considering the release-to-refresh state + private float mReleaseRatio = 1; + + // =========================================================== // Constructors // =========================================================== @@ -153,6 +157,11 @@ public final boolean demo() { return false; } + + @Override + public void setReleaseRatio(float ratio) { + mReleaseRatio = ratio; + } @Override public final Mode getCurrentMode() { @@ -1206,7 +1215,7 @@ private void pullEvent() { if (mState != State.PULL_TO_REFRESH && itemDimension >= Math.abs(newScrollValue)) { setState(State.PULL_TO_REFRESH); - } else if (mState == State.PULL_TO_REFRESH && itemDimension < Math.abs(newScrollValue)) { + } else if (mState == State.PULL_TO_REFRESH && (itemDimension * mReleaseRatio) < Math.abs(newScrollValue)) { setState(State.RELEASE_TO_REFRESH); } }