@@ -0,0 +1,1770 @@
+package org.ccci.gto.android.common.recyclerview.listener;%0A%0Aimport static android.support.v7.widget.RecyclerView.NO_POSITION;%0A%0Aimport android.support.annotation.NonNull;%0Aimport android.support.v7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.support.v7.widget.RecyclerView.LayoutManager;%0A%0Apublic abstract class LoadMoreOnScrollListener extends RecyclerView.OnScrollListener %7B%0A    private boolean mLoading = false;%0A    private int mThreshold = 5;%0A%0A    public void setThreshold(final int threshold) %7B%0A        mThreshold = threshold;%0A    %7D%0A%0A    @Override%0A    public void onScrolled(@NonNull final RecyclerView view, final int dx, final int dy) %7B%0A        // short-circuit if we are currently loading more data%0A        if (mLoading) %7B%0A            return;%0A        %7D%0A%0A        // short-circuit if there isn't a valid layout manager%0A        final LayoutManager layoutManager = view.getLayoutManager();%0A        if (layoutManager == null) %7B%0A            return;%0A        %7D%0A%0A        // determine the last visible item%0A        final int lastVisible;%0A        if (layoutManager instanceof LinearLayoutManager) %7B%0A            lastVisible = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();%0A        %7D else %7B%0A            lastVisible = getLastVisiblePosition(layoutManager);%0A        %7D%0A%0A        // have we passed the threshold to load more data?%0A        if (lastVisible + mThreshold %3E layoutManager.getItemCount() - 1) %7B%0A            mLoading = true;%0A            onLoadMore();%0A        %7D%0A    %7D%0A%0A    protected int getLastVisiblePosition(@NonNull final LayoutManager layoutManager) %7B%0A        return NO_POSITION;%0A    %7D%0A%0A    protected abstract void onLoadMore();%0A%0A    public final void doneLoading() %7B%0A        mLoading = false;%0A    %7D%0A%7D%0A

implement a load more scroll listener for RecyclerViews