Skip to content

Instantly share code, notes, and snippets.

View nvanbenschoten's full-sized avatar

Nathan VanBenschoten nvanbenschoten

  • Cockroach Labs
  • New York, New York
View GitHub Profile
@sveinungkb
sveinungkb / AdnroidFieldNamingPolicy.java
Last active April 18, 2020 17:02
GSON Field naming policy taking Android m-prefix into account (e.g. mField and mHomeAddress).
package co.sveinung.utils;
import com.google.gson.FieldNamingStrategy;
import java.lang.reflect.Field;
import java.util.regex.Pattern;
/**
* Created by sveinung on 21.02.15.
*/
@PeterAttardo
PeterAttardo / Shadow.java
Last active May 12, 2022 08:13
Android Shadow Drawing
package com.example.util.shadow;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import static android.graphics.drawable.GradientDrawable.Orientation.LEFT_RIGHT;
import static android.graphics.drawable.GradientDrawable.Orientation.TOP_BOTTOM;
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@nvanbenschoten
nvanbenschoten / SuccessiveClickUtil
Last active August 29, 2015 13:57
An Android utility class handling successive clicks in a given amount of time. Useful for easter eggs or extending default click behavior to more complicated situations.
/**
* Util class handling successive clicks in a given amount of time.
* Useful for easter eggs or extending default click behavior to more
* complicated situations.
*
* Created by Nathan VanBenschoten on 4/1/2014.
* Copyright (c) 2014 Tablelist LLC. All rights reserved.
*/
public class SuccessiveClickUtil {
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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
@imminent
imminent / CursorSubject.java
Last active August 11, 2016 17:21
CursorSubject is a Reactive Extension version of Android's CursorLoader. Handles retrieving the Cursor in a background thread, sending the result Cursor on the main thread, and resending a Cursor whenever the content changed notification is triggered.
package com.example.models;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Handler;
import android.os.Looper;
import java.io.Closeable;
import java.util.concurrent.atomic.AtomicReference;