Reputation: 691
I have implemented (from here- horizontal swipe on listview) swipe gesture to mark-unmark items in a listview. I used Johan Nilsson's pull to refresh implementation to refresh items in the listview. The pull to refresh feature showed some abrupt behaviour-
I have now switched to Chris Banes' implementation. The "pull to refresh" feature now works perfectly, but the "swipe" feature has stopped working. "Swipe" works perfectly otherwise.
final GestureDetector gestureDetector = new GestureDetector(
new MyGestureDetector());
View.OnTouchListener gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
};
postListView.setOnTouchListener(gestureListener);
postListView is PullToRefreshListView postListView = (PullToRefreshListView) linearLayout.findViewById(R.id.post_list);
I guess it's not working because even Chris' implementation makes use of-
public boolean onTouch(View v, MotionEvent event) {
//something over here
}
Now, how do I use it at both place without any conflict? I need to detect the gestures on listview's rows as well as listen to pull in listview.
Upvotes: 4
Views: 3643
Reputation: 149
postListView.getRefreshableView().setOnTouchListener(gestureListener); works for me
Upvotes: 4