Skip to content

Instantly share code, notes, and snippets.

View adavis's full-sized avatar

Annyce Davis adavis

View GitHub Profile
@adavis
adavis / NonOrganizerTest.kt
Last active September 17, 2021 09:32
Instrumentation tests for Jetpack Compose screen using Intents for navigation
@ExperimentalAnimationApi
@RunWith(AndroidJUnit4::class)
class NonOrganizerTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>()
@Before
fun goToNonOrganizerFragment() {
composeTestRule.activityRule.scenario.onActivity {
@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 / system_context.puml
Created November 27, 2022 20:07
A sample PlantUML file using the C4 model
@startuml Member+ Subscription
!include <C4/C4_Container>
Person(member, "Member")
System_Boundary(c1, "Member+ System") {
Container(api, "API", "Java 17, GraphQL", "Allows members to create and manage their subscriptions")
}
ContainerDb(db, "Database", "MySQL", "Holds plan, order and member information")
Rel(member, api, "Uses", "HTTPS")
@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)
@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 / ChipsView.kt
Last active March 26, 2024 02:00
A function to programmatically add views to ConstraintLayout with Flow
class ChipsView<T : Parcelable>(ctx: Context, attr: AttributeSet) : ConstraintLayout(ctx, attr) {
...
private fun addSubviews() {
val flow = Flow(context).apply {
id = generateViewId()
setWrapMode(Flow.WRAP_CHAIN)
setHorizontalStyle(Flow.CHAIN_PACKED)
setHorizontalAlign(Flow.HORIZONTAL_ALIGN_START)
setHorizontalBias(0f)
@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