I'm trying to completely disable SwipeRefreshLayout when inside the onLongClick of an item of the ListView.
I'm currently using setEnabled(false) but sometimes the swipe gesture get recognized anyways.
What could i try to stop this behaviour?
I'm trying to completely disable SwipeRefreshLayout when inside the onLongClick of an item of the ListView.
I'm currently using setEnabled(false) but sometimes the swipe gesture get recognized anyways.
What could i try to stop this behaviour?
I think doing this in onLongClick is too late to lock the SwipeRefreshLayout as the user-interaction is already happening.
You could e.g. look into somehow slightly increasing the touch slop value of your ListView to suppress accidental swipes.
Look over here for discussion: Android ACTION_MOVE Threshold
swipeLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// Your condition.
return true;
}
});