johannilsson/android-pulltorefresh

Tap to refresh is executed on normal list items

Closed this issue · 2 comments

Issue found on Andorid 2.2

Situation:
My list is a checkable multi select list.
I had just a few items in the list, so that the tap to refresh label is shown on top of the list.
When I click on one of the items to check it, a refresh is executed.

Problem:
In the method "onTouchEvent" are missing two brackets at this part of the code:

"if (mRefreshView.getHeight() > mRefreshViewHeight || mRefreshView.getTop() >= 0 && mRefreshState == RELEASE_TO_REFRESH)"

Even if mRefreshState is not equal to RELEASE_TO_REFRESH, the condition is true.
The trigger is that "mRefreshView.getHeight() > mRefreshViewHeight" is true and linked with an OR to all the other conditions.

Fix:
Suround the OR-condition with brackets, hence there is no refresh executed when mRefreshState has a wrong value.

Like this:
"if ((mRefreshView.getHeight() > mRefreshViewHeight || mRefreshView.getTop()) >= 0 && mRefreshState == RELEASE_TO_REFRESH)"

Regards,
Daniel

Good catch, thank you.

Thank you for the report. I hope this fixes the problem.