Skip to content

Instantly share code, notes, and snippets.

brian griffey briangriffey

  • Austin, TX
Block or report user

Report or block briangriffey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@briangriffey
briangriffey / VolleyAction
Created Oct 16, 2015
ResponseListenerAction.java
View VolleyAction
public class ResponseListenerAction<T> implements Action1<T> {
private Response.Listener<T> responseListener;
public ResponseListenerAction(Response.Listener<T> responseListener) {
this.responseListener = responseListener;
}
@Override
View sync cocktail
ContentResolver.setIsSyncable(account, StubProvider.AUTHORITY, 1);
ContentResolver.setSyncAutomatically(account, StubProvider.AUTHORITY, true);
ContentResolver.addPeriodicSync(account, StubProvider.AUTHORITY, new Bundle(), AbstractSyncableResource.SYNC_TIME);
View FloatLabelEditText
package com.homeaway.floatlabel.library;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
@briangriffey
briangriffey / ShareProvider
Last active Jun 17, 2016
How to change an icon on the shareactionprovider
View ShareProvider
package com.wahtever.views.actionbar;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ShareActionProvider;
import com.whatever.R;
import java.lang.reflect.InvocationTargetException;
@briangriffey
briangriffey / important gradle pieces
Last active Aug 29, 2015
Gradle pieces needed for robolectric integration in Android Studio
View important gradle pieces
task robolectric(type: Test, dependsOn: assembleRelease) {
testClassesDir = sourceSets.robolectric.output.classesDir
android.sourceSets.main.java.srcDirs.each { dir ->
project.getPlugins().getPlugin('android').prepareTaskMap.each {
sourceSets.robolectric.compileClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
sourceSets.robolectric.runtimeClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
}
@briangriffey
briangriffey / CuttingOffTextView.java
Created Nov 13, 2013
Makes sure text doesn't go beyond the boundaries of its measured height and adjusts itself to the maximum appropriate lines.
View CuttingOffTextView.java
package com.vice.viceforandroid.views;
import android.content.Context;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;
/**
* Created by briangriffey on 11/13/13.
View CircularDrawable.java
package com.sceneTap.views;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
@briangriffey
briangriffey / gist:6528687
Last active Dec 22, 2015
Simple addition to any gradle file to install to your local repository
View gist:6528687
uploadArchives {
repositories {
mavenDeployer {
repository url: 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
pom.artifactId = "yourartifactname"
pom.groupId = "com.yourgroup"
pom.version = "1.0.0-SNAPSHOT"
}
@briangriffey
briangriffey / NinePatchBitmapFactory.java
Last active Nov 25, 2019
Create 9-patches simlar to - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
View NinePatchBitmapFactory.java
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
You can’t perform that action at this time.