use of it.gmariotti.cardslib.library.view.listener.SwipeDismissListViewTouchListener in project cardslib by gabrielemariotti.
the class CardArrayAdapter method setupSwipeableAnimation.
/**
* Sets SwipeAnimation on List
*
* @param card {@link Card}
* @param cardView {@link it.gmariotti.cardslib.library.view.base.CardViewWrapper}
*/
protected void setupSwipeableAnimation(final Card card, CardViewWrapper cardView) {
if (card.isSwipeable()) {
if (mOnTouchListener == null) {
mOnTouchListener = new SwipeDismissListViewTouchListener(mCardListView, mCallback);
//Configure the default DismissableManager
if (mDismissable == null)
mDismissable = new DefaultDismissableManager();
mDismissable.setAdapter(this);
mOnTouchListener.setDismissable(mDismissable);
// ListView scrolling, we don't look for swipes.
if (mCardListView.getOnScrollListener() == null) {
SwipeOnScrollListener scrollListener = new SwipeOnScrollListener();
scrollListener.setTouchListener(mOnTouchListener);
mCardListView.setOnScrollListener(scrollListener);
} else {
AbsListView.OnScrollListener onScrollListener = mCardListView.getOnScrollListener();
if (onScrollListener instanceof SwipeOnScrollListener)
((SwipeOnScrollListener) onScrollListener).setTouchListener(mOnTouchListener);
}
mCardListView.setOnTouchListener(mOnTouchListener);
}
cardView.setOnTouchListener(mOnTouchListener);
} else {
//prevent issue with recycle view
cardView.setOnTouchListener(null);
}
}
Aggregations