I have recyclerview which contains horizontal child recycler views and in the end it has one single endless scrolling vertical recycler view child
<---RecyclerView-------->
<Horizonatl recycler view>
<Horizonatl recycler view>
<Vertical recyler view endless scrolling>
<---RecyclerView-------->
I have added wrap_content height to child Vertical recyler view due to which I am not able to add scroll listner to this child recylerview
I have added endless scroll listener to outermost parent recyclerview but scroll is working till page 2 only and then its not working how can I achieve nested infinite scroll. Following is my code for listener applied on parent recyclerview
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
visibleItemCount = recyclerView.getChildCount();
totalItemCount = layoutManager.getItemCount();
firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
if (dy > 0) {
if (loading) {
if (totalItemCount > previousTotal) {
loading = false;
previousTotal = totalItemCount;
loading = false;
currentPage++;
}
}
if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
if (Utils.haveNetworkConnection(getActivity()) && currentPage < Constants.MAX_PAGES) {
loadMoreData();
loading = true;
}
}
}
}