|
@@ -9,12 +9,12 @@ public class EndlessGridScrollListener extends RecyclerView.OnScrollListener {
|
|
|
|
|
|
private int previousTotal = 0;
|
|
|
private boolean loading = true;
|
|
|
- private int visibleThreshold = 5;
|
|
|
+ private static final int VISIBLE_THRESHOLD = 5;
|
|
|
private int firstVisibleItem, visibleItemCount, totalItemCount;
|
|
|
|
|
|
- private GridLayoutManager layoutManager;
|
|
|
+ private final GridLayoutManager layoutManager;
|
|
|
|
|
|
- private Action0 requestNext;
|
|
|
+ private final Action0 requestNext;
|
|
|
|
|
|
public EndlessGridScrollListener(GridLayoutManager layoutManager, Action0 requestNext) {
|
|
|
this.layoutManager = layoutManager;
|
|
@@ -39,7 +39,7 @@ public class EndlessGridScrollListener extends RecyclerView.OnScrollListener {
|
|
|
previousTotal = totalItemCount;
|
|
|
}
|
|
|
if (!loading && (totalItemCount - visibleItemCount)
|
|
|
- <= (firstVisibleItem + visibleThreshold)) {
|
|
|
+ <= (firstVisibleItem + VISIBLE_THRESHOLD)) {
|
|
|
|
|
|
requestNext.call();
|
|
|
loading = true;
|