Skip to content

Instantly share code, notes, and snippets.

Avatar

Annyce Davis adavis

View GitHub Profile
@adavis
adavis / AppComponent.java
Last active Mar 2, 2019
Background Jobs with Android Job and Dagger
View AppComponent.java
@Singleton
@Component(
modules = {
AppModule.class, JobsModule.class
}
)
public interface AppComponent
{
Application getApplication ();
@adavis
adavis / BeforeLoginActivityTest.java
Last active Mar 12, 2019
Using Screen Robots with Android Espresso Tests
View BeforeLoginActivityTest.java
package <your_package>;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@adavis
adavis / RightVideo.java
Last active Jan 9, 2016
Sample demonstrating using Builder Pattern for VO
View RightVideo.java
package info.adavis.sample.models;
/**
* Sample Domain Object used for demonstration
*
* @author Annyce Davis
*/
public class Video {
private long id;
@adavis
adavis / WrongVideo.java
Last active Jan 9, 2016
Demonstrates needless data being created inside test method
View WrongVideo.java
package info.adavis.sample.models;
/**
* Sample Domain Object used for demonstration
*
* @author Annyce Davis
*/
public class Video {
private long id;
View findbugs-exclude.xml
<FindBugsFilter>
<Match>
<Class name="~.*R\$.*"/>
</Match>
<Match>
<Class name="~.*Manifest\$.*"/>
</Match>
<Match>
<Class name="~.*_234$"/>
</Match>
@adavis
adavis / cobertura_spring_boot
Created Jul 12, 2015
Cobertura Coverage for Spring Boot App
View cobertura_spring_boot
plugins {
id 'net.saliman.cobertura' version '2.2.7'
}
cobertura {
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
coverageIgnores = []
coverageReportDir = new File("$buildDir/reports/cobertura")
}
@adavis
adavis / checkstyle
Created Jun 22, 2015
Checkstyle configuration for use in Android projects.
View checkstyle
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="FileLength"><property name="max" value="800"/></module>
<module name="TreeWalker">
<module name="MethodLength"><property name="max" value="60"/></module>
@adavis
adavis / async_task_live_template
Created Jun 8, 2015
A simple live template for Android Studio that surrounds the current selection with an Async Task.
View async_task_live_template
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
$SELECTION$
return null;
}
@Override
protected void onPostExecute(Void result) {
@adavis
adavis / blur_darken_transform
Last active Jul 3, 2017
This is a Picasso transform that blurs and darkens an image.
View blur_darken_transform
private final class BlurTransform implements Transformation {
WeakReference<Context> context;
public BlurTransform(Context context) {
super();
this.context = new WeakReference<>(context);
}
@Override
@adavis
adavis / custom_gson_deserialization
Created Oct 28, 2014
Custom Gson Deserialization
View custom_gson_deserialization
public class CarVO implements Serializable {
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface SkipThis {
// Field tag only annotation
}
private static final long serialVersionUID = 1824858721250363381L;
You can’t perform that action at this time.