Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
I GOT A SP BBT 2021

devflow devflow

🍻
I GOT A SP BBT 2021
View GitHub Profile
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active Oct 1, 2021
Endless RecyclerView OnScrollListener
View EndlessRecyclerOnScrollListener.java
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;
@jgilfelt
jgilfelt / DrawerSafeViewPager.java
Last active Dec 19, 2015
DrawerLayout friendly ViewPager that will ignore rogue touch events from the bezel swipe gesture.
View DrawerSafeViewPager.java
/*
* Copyright (C) 2013 readyState Software Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software