Skip to content

Instantly share code, notes, and snippets.

Christopher Perry christopherperry

Block or report user

Report or block christopherperry

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
@christopherperry
christopherperry / CheckableLinearLayout
Created Sep 18, 2012
A LinearLayout that implements the Checkable interface, allowing a LinearLayout to be put into a checked state.
View CheckableLinearLayout
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.LinearLayout;
@christopherperry
christopherperry / robolectric-library-resource-loading.java
Created Aug 30, 2012 — forked from pplante/robolectric-library-resource-loading.java
Robolectric does not support loading resources from an Android Library project such as ActionBarSherlock of FlyInMenu, so this patch allows you to specify a library project to load resources in tests.
View robolectric-library-resource-loading.java
// In ResourceLoader.java I added the following method:
//
public void loadLibraryProjectResources(File libraryProjectRoot) throws Exception {
File systemResourceDir = getSystemResourceDir(getPathToAndroidResources());
File localValueResourceDir = getValueResourceDir(libraryProjectRoot);
File systemValueResourceDir = getValueResourceDir(systemResourceDir);
loadStringResources(localValueResourceDir, systemValueResourceDir);
loadPluralsResources(localValueResourceDir, systemValueResourceDir);
loadValueResources(localValueResourceDir, systemValueResourceDir);
@christopherperry
christopherperry / SwipeLinearLayout.java
Created Aug 27, 2012
Android LinearLayout that handles left swipes.
View SwipeLinearLayout.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.widget.LinearLayout;
public class SwipeLinearLayout extends LinearLayout {
private GestureDetector gestureDetector;
private OnSwipeListener listener;
@christopherperry
christopherperry / adb+
Created Jul 30, 2012
A bash script that let's you issue adb commands to multiple devices at once
View adb+
#!/bin/bash
# Script adb+
# Usage
# You can run any command adb provides on all your currently connected devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
#
# Examples
# ./adb+ version
# ./adb+ install apidemo.apk
# ./adb+ uninstall com.example.android.apis
@christopherperry
christopherperry / AndroidVersion.java
Created Jul 27, 2012
Robolectric test runner with Guice injection, custom class binding using annotations, and android version support.
View AndroidVersion.java
package annotations;
import android.os.Build;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
You can’t perform that action at this time.