This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TouchDelegatingRecyclerView extends RecyclerView { | |
private static final String TAG = TouchDelegatingRecyclerView.class.getSimpleName(); | |
private static final int UP_SWIPE = 803; | |
private static final int DOWN_SWIPE = UP_SWIPE + 1; | |
private float originalY = 0; | |
private int swipeDirection = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); | |
MyViewPagerAdapter adapter = new MyViewPagerAdapter(getSupportFragmentManager()); | |
viewPager.setAdapter(adapter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SparseBooleanArray that is also Parcelable. Had to put this together so I could pass this to a | |
* {@code Fragment} bundle. | |
*/ | |
public class ParcelableSparseBooleanArray extends SparseBooleanArray implements Parcelable { | |
public ParcelableSparseBooleanArray(){ | |
super(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isTriangularNumber(int number) { | |
return (((Math.sqrt((8*number)+1)) % 1) == 0) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Color; | |
public final class PaintUtils { | |
private PaintUtils() { throw new AssertionError(); } | |
public static int createInterimColor(int colorFrom, int colorTo, float percentage) { | |
int[] colorFromArray, colorToArray; | |
colorFromArray = new int[] { |
NewerOlder