Skip to content

Instantly share code, notes, and snippets.

View Aenterhy's full-sized avatar

Roman Herasimenko Aenterhy

  • Fintech Band
  • United Kingdom
View GitHub Profile
@Aenterhy
Aenterhy / EndlessRecyclerOnScrollListener.java
Last active August 29, 2015 14:27 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;