Skip to content

Instantly share code, notes, and snippets.

View imminent's full-sized avatar

Dandre' Allison imminent

  • Life360
  • San Francisco
View GitHub Profile
@imminent
imminent / AccountUtils.java
Created November 12, 2012 19:55
Utility to retrieve user profile on Android device
/**
* A collection of authentication and account connection utilities. With strong inspiration from the Google IO session
* app.
* @author Dandré Allison
*/
public class AccountUtils {
/**
* Interface for interacting with the result of {@link AccountUtils#getUserProfile}.
*/
@imminent
imminent / MapMarkerBounce.java
Created June 16, 2015 23:44
Makes a Android Google Maps marker animate a bounce
import android.os.Handler;
import android.os.SystemClock;
import android.view.animation.BounceInterpolator;
import android.view.animation.Interpolator;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
/**
* Performs a bounce animation on a {@link Marker} when it is clicked.
@imminent
imminent / Api.java
Last active June 13, 2023 02:50
Call retrying with Retrofit 2.0
package com.example.api;
import java.util.Map;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
public interface Api {
@imminent
imminent / Api.java
Created October 15, 2015 16:16
Handling multiple API subdomains with Retrofit 2.0
package com.example.api;
import java.util.Map;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
public interface Api {
@imminent
imminent / HorizontalFavoringNestedScrollView.java
Created June 3, 2016 19:09
A custom NestedScrollView that delays vertical scrolling, providing more leniency to horizontal scrolling
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
@imminent
imminent / ClickActors.kt
Created November 25, 2017 18:36
Kotlin actor extensions for Android listeners
/**
* MIT License
*
* Copyright (c) 2017 Dandré Allison
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@imminent
imminent / OverscrollingAppBarBehavior.java
Created April 28, 2017 00:55
Overscrolling with Collapsing Toolbar
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.View;
@SuppressWarnings("unused")
public class OverscrollingAppBarBehavior extends AppBarLayout.Behavior {
@SuppressWarnings("unused")
@imminent
imminent / OnDestroy.kt
Last active March 29, 2018 23:21
OnDestroy Property Delegate
/**
* MIT License
*
* Copyright (c) 2018 Dandré Allison
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@imminent
imminent / AndroidCookieStore.java
Created July 5, 2013 16:00
Example of a persistent cookie store that only keeps one cookie around.
package com.example.android.utilities;
import android.content.SharedPreferences;
import android.os.PatternMatcher;
import android.util.Log;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.URI;
import java.util.List;
@imminent
imminent / OnCreate.kt
Last active November 23, 2017 08:37
OnCreate Property Delegate
/**
* MIT License
*
* Copyright (c) 2017 Dandré Allison
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is