Skip to content

Instantly share code, notes, and snippets.

Avatar

Drew Hannay drewhannay

View GitHub Profile
@drewhannay
drewhannay / FinishingActivityTestRule.java
Last active Jun 21, 2017
Android Espresso Activity Clean Up
View FinishingActivityTestRule.java
/**
* Copyright (C) 2017 Drew Hannay
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
View ExampleTestRunner.java
package com.linkedin.util;
import android.os.Bundle;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnitRunner;
import com.linkedin.android.testbutler.TestButler;
public class ExampleTestRunner extends AndroidJUnitRunner {
@Override
View Android Studio TAG Class Template
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
private static final String TAG = "${NAME}";
}
View ExpandableItemViewHolder.java
import android.animation.ValueAnimator;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.animation.LinearInterpolator;
public abstract class ExpandableItemViewHolder extends RecyclerView.ViewHolder {
private int mOriginalHeight;
private boolean mIsViewExpanded;
@drewhannay
drewhannay / AsyncTaskLoaderBase.java
Last active Aug 29, 2015
Extension of Android's AsyncTaskLoader which takes care of the boilerplate details and adds support for loading Broadcasts
View AsyncTaskLoaderBase.java
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.LocalBroadcastManager;
/**
* Base class which takes care of the boilerplate details involved in extending
* AsyncTaskLoader and adds convenience methods for registering and unregistering
* an observer for the Loader
*
@drewhannay
drewhannay / adbDb.sh
Created Aug 24, 2014
Simple shell script to pull, push, and list database files for an Android emulator or device
View adbDb.sh
if [ $# -lt 1 ]
then
echo "Usage:"
echo " commands"
echo " setOptions \$databaseName \$packageName"
echo " ls"
echo " pull"
echo " push"
exit
@drewhannay
drewhannay / vim_commands
Last active Dec 13, 2015
Helpful Vim Commands
View vim_commands
# Select entire paragraph and rewrap the text
vip gq
# vim LaTeX
zr # unfold one level
zR # unfold all levels
zm # fold one level
zM # fold all levels
\ll # compile LaTeX document
\lv # view compiled LaTeX PDF
You can’t perform that action at this time.