Skip to content

Instantly share code, notes, and snippets.

internal fun <S : Any> Any.accessField(fieldName: String): S? =
javaClass.getDeclaredField(fieldName).let { field ->
field.isAccessible = true
return@let field.get(this) as S
}
internal fun Any.writeField(fieldName: String, value: Any) =
javaClass.getDeclaredField(fieldName).let { field ->
field.isAccessible = true
field.set(this, value)
@rcgroot
rcgroot / OAuthStack.java
Last active November 11, 2015 23:55
OAuth 1.0a with Signport on Volley including support for multiple operations and volleys multithreading
/*
** ------------------------------------------------------------------------------
** 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
** ------------------------------------------------------------------------------
*/
package nl.sogeti.android.deviceprofiler.network;
import android.support.v4.util.LongSparseArray;
@rcgroot
rcgroot / gist:cf30c81e5492a8afd88b
Created November 3, 2014 08:48
Enlarge the touch targets of small views in Android
import android.content.Context;
import android.graphics.Rect;
import android.view.TouchDelegate;
import android.view.View;
/**
* <p>
* Ensures minimum hitbox size of small touch targets. For example:
* <p>