From 6002beaf1423fc2261e20d0528f27d3aff98c77d Mon Sep 17 00:00:00 2001 From: Brendan Ribera Date: Sat, 7 Jan 2012 00:36:54 -0800 Subject: [PATCH 1/5] Prevent ListViews from getting temporarily stuck after being flung. --- .../pulltorefresh/library/PullToRefreshBase.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java index 8692b7d64..ae82c4680 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java @@ -348,13 +348,10 @@ public final boolean onInterceptTouchEvent(MotionEvent event) { return true; } - switch (event.getAction()) { - case MotionEvent.ACTION_MOVE: - if (checkEventForInitialPull(event)) { - return true; - } - break; - } + if (checkEventForInitialPull(event)) { + return true; + } + } return false; @@ -535,7 +532,7 @@ private void pullEvent(MotionEvent event, float firstY) { } private boolean checkEventForInitialPull(MotionEvent event) { - if (startY == -1 && isReadyForPull()) { + if (startY == -1) { updateEventStates(event); // Need to set current Mode if we're using both From 5253a451a9b71300cebbecdd983568df3b43756e Mon Sep 17 00:00:00 2001 From: Brendan Ribera Date: Sat, 7 Jan 2012 01:09:05 -0800 Subject: [PATCH 2/5] Store the initial ACTION_DOWN so we can pull down immediately, even when at the top of the adapterView. --- .../com/handmark/pulltorefresh/library/PullToRefreshBase.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java index ae82c4680..eeb7347eb 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ b/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java @@ -330,6 +330,9 @@ public final boolean onTouchEvent(MotionEvent event) { } break; case MotionEvent.ACTION_DOWN: + if (startY == -1) { + updateEventStates(event); + } // We need to return true here so that we can later catch // ACTION_MOVE return true; From 88e6fa0795dfafb5ed50e529c3e5fa2f94ec0d72 Mon Sep 17 00:00:00 2001 From: Brendan Ribera Date: Thu, 3 May 2012 15:02:03 -0700 Subject: [PATCH 3/5] Make LoadingLayout use the supplied background. --- .../pulltorefresh/library/internal/LoadingLayout.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java b/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java index be6c9c931..bad963516 100644 --- a/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java +++ b/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.text.Html; import android.text.TextUtils; import android.view.LayoutInflater; @@ -56,6 +57,13 @@ public LoadingLayout(Context context, final int mode, TypedArray attrs) { mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); + if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) { + Drawable background = attrs.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground); + if (null != background) { + setBackgroundDrawable(background); + } + } + switch (mode) { case PullToRefreshBase.MODE_PULL_UP_TO_REFRESH: From 74e2cd47c3abd08ba38e40c7cf6cdd14da4438bf Mon Sep 17 00:00:00 2001 From: Brendan Ribera Date: Thu, 3 May 2012 15:03:48 -0700 Subject: [PATCH 4/5] Include a default value for pull_to_refresh_tap_label. --- library/res/values/pull_refresh_strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/res/values/pull_refresh_strings.xml b/library/res/values/pull_refresh_strings.xml index fe48f3bc0..95b74bbac 100755 --- a/library/res/values/pull_refresh_strings.xml +++ b/library/res/values/pull_refresh_strings.xml @@ -3,11 +3,11 @@ Pull to refresh… Release to refresh… + Tap to refresh… Loading… - @string/pull_to_refresh_pull_label @string/pull_to_refresh_release_label @string/pull_to_refresh_refreshing_label - \ No newline at end of file + From 8efafa84b800c1730c0bca2565ba846708475d0d Mon Sep 17 00:00:00 2001 From: Brendan Ribera Date: Thu, 3 May 2012 15:30:38 -0700 Subject: [PATCH 5/5] Use the XML entity rather than the character. --- library/res/values/pull_refresh_strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/res/values/pull_refresh_strings.xml b/library/res/values/pull_refresh_strings.xml index 95b74bbac..3b39ecee3 100755 --- a/library/res/values/pull_refresh_strings.xml +++ b/library/res/values/pull_refresh_strings.xml @@ -1,10 +1,10 @@ - Pull to refresh… - Release to refresh… + Pull to refresh… + Release to refresh… Tap to refresh… - Loading… + Loading… @string/pull_to_refresh_pull_label @string/pull_to_refresh_release_label