4

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-

  • sometimes showing "Tap to Refresh"
  • sometimes not hiding completely
  • sometimes not changing from "Pull to refresh" to "Release..."

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.

Community
  • 1
  • 1
gandharva
  • 691
  • 5
  • 16

1 Answers1

4

postListView.getRefreshableView().setOnTouchListener(gestureListener); works for me

Ezeki
  • 149
  • 1
  • 2
  • Thanks @Ezeki, it's working for me too. I couldn't find anyway to do so, when I had posted it. It's a new change. – gandharva Feb 16 '12 at 08:08