This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GuidedWorkoutFragment : TonalFragment(R.layout.guided_workout_fragment) { | |
override val daggerComponent: GuidedWorkoutMergeComponent by fragmentComponent { scope, app -> | |
app.bindings<GuidedWorkoutMergeComponent.Parent>().guidedWorkoutComponentBuilder() | |
.coroutineScope(WorkoutCoroutineScope(scope)) | |
.args(arg) | |
.build() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tonal.trainer.anvilcompilers | |
import com.google.auto.service.AutoService | |
import com.squareup.anvil.annotations.ContributesTo | |
import com.squareup.anvil.compiler.api.AnvilContext | |
import com.squareup.anvil.compiler.api.CodeGenerator | |
import com.squareup.anvil.compiler.api.GeneratedFile | |
import com.squareup.anvil.compiler.api.createGeneratedFile | |
import com.squareup.anvil.compiler.internal.asClassName | |
import com.squareup.anvil.compiler.internal.buildFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Adds a Java agent that sets a defaultUncaughtExceptionHandler for all jvm test modules, | |
* to ensure that exceptions thrown in Rx subscriptions (and coroutines?) aren't lost. | |
* | |
* Usually, one would do this with a JUnit RunListener, but Gradle doesn't support JUnit | |
* RunListeners, see https://github.com/gradle/gradle/issues/1330 | |
* | |
* This workaround adds a test dependency for all modules to the module containing the uncaught | |
* exception handler. This module contains a Java agent, which is called before JUnit runs. To | |
* setup the agent we compile the jar and add the filepath as JVM argument. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.mtg.api | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.flow | |
import retrofit2.* | |
import java.lang.reflect.ParameterizedType | |
import java.lang.reflect.Type | |
class FlowCallAdapterFactory private constructor() : CallAdapter.Factory() { | |
companion object { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.graphics.Point | |
import android.graphics.Rect | |
import android.util.AttributeSet | |
import android.view.View | |
import android.view.ViewParent | |
import com.google.android.material.textfield.TextInputEditText | |
import com.google.android.material.textfield.TextInputLayout | |
class MyTextInputEditText : TextInputEditText { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
# well, so I wrote my own script to do the simple job of converting package names. | |
# | |
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
# | |
# It'll run faster on a clean build because then there are fewer files to scan over. | |
# | |
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile on JDK 9 or 10 with javac -source 1.8 -target 1.8 CallDefaultMethodThroughReflection.java | |
// Blog post here: https://blog.jooq.org/2018/03/28/correct-reflective-access-to-interface-default-methods-in-java-8-9-10 | |
import java.lang.invoke.MethodHandles; | |
import java.lang.invoke.MethodHandles.Lookup; | |
import java.lang.invoke.MethodType; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2018 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The MIT License | |
* | |
* Copyright (c) 2016 Andreas Ahlenstorf | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fewlaps.android.permissiongranter; | |
import android.app.Activity; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
import android.support.test.uiautomator.UiDevice; | |
import android.support.test.uiautomator.UiObject; | |
import android.support.test.uiautomator.UiObjectNotFoundException; | |
import android.support.test.uiautomator.UiSelector; | |
import android.support.v4.content.ContextCompat; |
NewerOlder