You can integrate the Actionbar-PullToRefresh library with the StickyListHeaders library, but you need to use a custom delegate for Actionbar-PullToRefresh to work correctly:
public class StickyListViewDelegate extends AbsListViewDelegate { @Override public boolean isReadyForPull(View view, final float x, final float y) { StickyListHeadersListView sticky = (StickyListHeadersListView) view; return super.isReadyForPull(sticky.getWrappedList(), x, y); }
Integrated as follows:
StickyListViewDelegate delegate = new StickyListViewDelegate(); ActionBarPullToRefresh.from(getActivity()).theseChildrenArePullable(mListView) .useViewDelegate(StickyListHeadersListView.class, delegate) .listener(this).setup(mPullToRefreshLayout);
The reason the two libraries do not work together is because the StickyListHeadersListView class does not actually extend the ListView (this is what the Actionbar-PullToRefresh library looks for when assigning a default delegate).
Andrew Emery
source share