timroes / EnhancedListView

[DEPRECATED] An Android ListView with enhanced functionality (e.g. Swipe To Dismiss or Undo)
Other
463 stars 147 forks source link

Swipeable list items inside a fragment in a ViewPager #47

Open Drakuwa opened 10 years ago

Drakuwa commented 10 years ago

Hello all,

I'm having trouble with the EnhancedListView in a fragment from ViewPager. I'm not sure if this question has been answered here, but I couldn't find a solution.

I've initialized an enhanced list view with a custom BaseAdapter which is in a the first out of 3 fragments of a view pager. The swiping (SwipeDirection.END) only works when my list is scrolling and I interrupt the scrolling with a horizontal slide on top of a list item. When the list isn't scrolling, the swipe on top of a list item isn't detected.

I tried calling view.getParent().requestDisallowInterceptTouchEvent(true); for every single list item in the adapter, but that only cancels the list view scrolling, and view.getParent().getParent().requestDisallowInterceptTouchEvent(true); which cancels the swiping to the next fragment but does not enable swipe to dismiss.

For the record, I initialize the list like this: EnhancedListView lv = (EnhancedListView) v.findViewById(R.id.transactionsList); lv.setAdapter(adapter); lv.enableSwipeToDismiss(); // transactionHolder - id of the list item layout lv.setSwipingLayout(R.id.transactionHolder); EnhancedListView.UndoStyle style = UndoStyle.SINGLE_POPUP; lv.setUndoStyle(style); EnhancedListView.SwipeDirection direction = SwipeDirection.END; lv.setSwipeDirection(direction);