Skip to content

Instantly share code, notes, and snippets.

Annyce Davis adavis

Block or report user

Report or block adavis

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
@adavis
adavis / ConfettiJobCreator.kt
Last active Jun 21, 2019
Snippets from Dagger and Dynamic Feature Module Support Article
View ConfettiJobCreator.kt
class ConfettiJobCreator @Inject constructor(
private val jobs: @JvmSuppressWildcards Map<String, Provider<Job>>
) : JobCreator {
override fun create(tag: String): Job? = jobs[tag]?.get()
}
@adavis
adavis / unique_id_widget.dart
Last active Apr 25, 2019
Displays a pin number pad with 6 fields
View unique_id_widget.dart
import 'dart:math' show min;
import 'package:flutter/material.dart';
class UniqueId extends StatefulWidget {
const UniqueId({Key key, this.onSubmit}) : super(key: key);
final ValueChanged<String> onSubmit;
@adavis
adavis / tests_with_coverage.sh
Last active Aug 17, 2019
Script for running all Flutter unit and widget tests with code coverage and then displaying the HTML report.
View tests_with_coverage.sh
#!/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)
@adavis
adavis / PULL_REQUEST_TEMPLATE.md
Last active Sep 6, 2018
Sample Pull Request template for use on GitHub
View PULL_REQUEST_TEMPLATE.md

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 / PlanetDetailUi.kt
Last active Dec 16, 2017
Implementation of the createView method for a Sample Anko Component
View PlanetDetailUi.kt
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 / CommonExtensions.kt
Last active Aug 21, 2019
Common Android Extensions in Kotlin
View CommonExtensions.kt
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
View CompanionObject.kt
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"
}
View MigrationAfter.java
@Reusable
public class Migration implements RealmMigration
{
private Map<Integer, Provider<VersionMigration>> versionMigrations;
@Inject
Migration (Map<Integer, Provider<VersionMigration>> versionMigrations)
{
this.versionMigrations = versionMigrations;
}
View MigrationBefore.java
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" );
@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 ();
You can’t perform that action at this time.