Skip to content

Instantly share code, notes, and snippets.

View bkosawa's full-sized avatar

Bruno Kosawa bkosawa

View GitHub Profile
private fun dispatchTakePictureIntent() {
val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(packageManager) != null) {
// Create the File where the photo should go
var photoFile: File? = null
try {
photoFile = createImageFile()
@bkosawa
bkosawa / PageChangeListener.java
Last active November 10, 2015 19:23
Fade on page listener
private class PageChangeListener extends TabLayout.TabLayoutOnPageChangeListener {
private static final float THRESHOLD = 0.10f;
private static final int MAX_ALPHA = 255;
private static final float FADING_RATE = 3;
private int mCurrentTabPosition;
private float mOldPositionOffset;
private float mDx;