Skip to content

Instantly share code, notes, and snippets.

View adavis's full-sized avatar

Annyce Davis adavis

View GitHub Profile
@adavis
adavis / RightVideo.java
Last active January 9, 2016 17:44
Sample demonstrating using Builder Pattern for VO
package info.adavis.sample.models;
/**
* Sample Domain Object used for demonstration
*
* @author Annyce Davis
*/
public class Video {
private long id;
@adavis
adavis / BeforeLoginActivityTest.java
Last active April 7, 2022 13:58
Using Screen Robots with Android Espresso Tests
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 / AppComponent.java
Last active March 2, 2019 15:18
Background Jobs with Android Job and Dagger
@Singleton
@Component(
modules = {
AppModule.class, JobsModule.class
}
)
public interface AppComponent
{
Application getApplication ();
public class Migration implements RealmMigration
{
@Override
public void migrate (DynamicRealm realm, long oldVersion, long newVersion)
{
RealmSchema schema = realm.getSchema();
if ( oldVersion == 1 )
{
RealmObjectSchema recipeSchema = schema.get( "Recipe" );
@Reusable
public class Migration implements RealmMigration
{
private Map<Integer, Provider<VersionMigration>> versionMigrations;
@Inject
Migration (Map<Integer, Provider<VersionMigration>> versionMigrations)
{
this.versionMigrations = versionMigrations;
}
companion object {
const val PMD_FILE_NAME = "pmd-ruleset.xml"
const val CHECKSTYLE_FILE_NAME = "checkstyle.xml"
const val FINDBUGS_FILE_NAME = "findbugs-exclude.xml"
const val WRITE_PMD_CONFIG_FILE_TASK = "writePmdConfigFile"
const val WRITE_CHECK_STYLE_CONFIG_FILE_TASK = "writeCheckStyleConfigFile"
const val WRITE_FIND_BUGS_EXCLUSION_FILE_TASK = "writeFindBugsExclusionFile"
const val VERIFICATION_GROUP = "verification"
const val PLUGIN_EXTENSION_NAME = "qualityChecks"
}
@adavis
adavis / CommonExtensions.kt
Last active April 2, 2024 20:51
Common Android Extensions in Kotlin
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
@adavis
adavis / PlanetDetailUi.kt
Last active December 16, 2017 14:46
Implementation of the createView method for a Sample Anko Component
override fun createView(ui: AnkoContext<PlanetDetailFragment>): View {
return with(ui) {
val container = verticalLayout {
lparams(matchParent)
textView {
setLineSpacing(8f, 1f)
}.lparams {
topMargin = dip(16)
}
@adavis
adavis / PULL_REQUEST_TEMPLATE.md
Last active March 23, 2024 19:36
Sample Pull Request template for use on GitHub

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixed #issue

Type of Change

Please delete options that are not relevant.

@adavis
adavis / tests_with_coverage.sh
Last active January 2, 2024 22:55
Script for running all Flutter unit and widget tests with code coverage and then displaying the HTML report.
#!/usr/bin/env bash
red=$(tput setaf 1)
none=$(tput sgr0)
show_help() {
printf "usage: $0 [--help] [--report] [--test] [<path to package>]
Script for running all unit and widget tests with code coverage.
(run from root of repo)