Skip to content

Instantly share code, notes, and snippets.

package dk.shape.goboat.animation.animators;
import android.content.Context;
import android.view.Choreographer;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MapStyleOptions;
@BenDLH
BenDLH / gist:3d910a25513199caee848a3b05fb8d1e
Last active January 2, 2018 10:24
SHA-1 for Android app
Debug keystore
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Productsion keystore
keytool -list -v -keystore C:\Users\Ben\{path-to-key}\keystore.jks -alias {alias} -storepass {store-password} -keypass {key-password}
@BenDLH
BenDLH / PermissionsHelper.java
Last active December 31, 2018 19:49
Android Marshmallow Permissions Helper
package dk.shape.goboat.managers;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import java.util.ArrayList;
@BenDLH
BenDLH / SlideItemAnimator.java
Created January 16, 2017 13:02
SlideItemAnimator
package dk.shape.goboat.animation.animators;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.RecyclerView;
@BenDLH
BenDLH / CloudTemp-v5.ino
Created December 11, 2016 13:12
Reads temp and humidity from DHT22 sensor and writes values to LCD panel, Particle server and Serial.
#include "Adafruit_DHT.h"
#include "LiquidCrystal.h"
//
// Ben De La Haye
// CloudTemp-v5.ino
//
// Reads temp and humidity from DHT22 sensor and writes values to LCD panel, Particle
// server and Serial.
@BenDLH
BenDLH / commands.txt
Created October 22, 2016 18:06
Connect to Dragonboard 410c GPIO's via adb
adb devices (See if Dragonboard is connected)
adb shell (Open shell on Dragonboard)
su (Need super user access)
cd sys/class/gpio (Navigate to GPIO directory)
==> GPIO pin numbers are offset by 902 (pin 34 => GPIO 935)
echo {GPIO number, eg. 935} > export (Exports GPIO to be accessed and modified)
cd {exported GPIO number directory, eg. gpio935}
ls (Lists commands available for GPIO)
cat direction (prints direction (IN or OUT))
@BenDLH
BenDLH / parallax_header_example.xml
Last active October 18, 2016 07:30
Sample implementation of the ParallaxScrollBehaviour
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
@BenDLH
BenDLH / ParallaxScrollBehaviour.java
Last active February 21, 2017 13:05
CoordinatorLayout behaviour for a parallaxing header above a RecyclerView
//
// ParallaxScrollBehaviour
// Created by Ben De La Haye on 17/10/2016
//
public class ParallaxScrollBehavior<V extends View> extends CoordinatorLayout.Behavior<V> {
private static final float PARALLAX_RATIO = 0.8f;
private RecyclerView _recyclerView;
@BenDLH
BenDLH / BaseAuthActivity.java
Created October 4, 2016 07:56
A basic implementation of the GoogleSignInManager
//
// BaseAuthActivity
// Created by Ben De La Haye on 28/04/2016.
//
public abstract class BaseAuthActivity extends BaseActivity implements GoogleSignInManager.Listener, Callback<LoginResponse> {
private GoogleSignInManager _googleSignInManager;
private AuthenticatedUser authenticatedUser;
public abstract void onUserLoggedIn();
@BenDLH
BenDLH / GoogleSignInManager.java
Created October 4, 2016 07:52
Helper class for integrating Google sign in on Android
//
// GoogleSignInManager
// Created by Ben De La Haye on 24/03/2016.
//
public class GoogleSignInManager implements GoogleApiClient.OnConnectionFailedListener {
public interface Listener {
void onUserSignedIn(GoogleSignInAccount account);
void onUserSignInFailed(int errorCode, String errorMessage);
void onUserDataRetrieved(@Nullable Person person);