Skip to content

Instantly share code, notes, and snippets.

Avatar

Annyce Davis adavis

View GitHub Profile
View background_black_border_full.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="rectangle">
<solid android:color="@color/light_blue"/>
</shape>
</item>
@adavis
adavis / android_wearable_connected
Created Jul 28, 2014
How to determine if an Android Wear device is connected
View android_wearable_connected
private boolean isConnectedToWearable = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!servicesAvailable()) {
finish();
}
@adavis
adavis / android_box_inset_layout
Created Sep 11, 2014
An example of using the Wearable Support BoxInsetLayout view
View android_box_inset_layout
<android.support.wearable.view.BoxInsetLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:id="@+id/textViewsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
@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;
@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 / 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 / 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 / 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")
}
View findbugs-exclude.xml
<FindBugsFilter>
<Match>
<Class name="~.*R\$.*"/>
</Match>
<Match>
<Class name="~.*Manifest\$.*"/>
</Match>
<Match>
<Class name="~.*_234$"/>
</Match>
@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;
You can’t perform that action at this time.