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
android.applicationVariants.all { variant -> | |
configurations.create("${variant.name}IntegrationTestImplementation") { | |
extendsFrom configurations.find { it.name == "implementation" } | |
extendsFrom configurations.find { it.name == "${variant.name}Implementation" } | |
} | |
def sourceSet = android.sourceSets.create("${variant.name}IntegrationTest") { | |
// this fails here because `compileClasspath` is not existant in `AndroidSourceSet` | |
compileClasspath += variant.javaCompile.classpath | |
runtimeClasspath += variant.javaCompile.classpath |
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
fun <T : Fragment> FragmentActivity.getOrAddFragment(tag: String, commitNow: Boolean = true, initFun: () -> T): T = | |
supportFragmentManager.findFragmentByTag(tag) as? T ?: run { | |
initFun().also { | |
addFragment(supportFragmentManager, tag, commitNow, it) | |
} | |
} | |
fun <T : Fragment> Fragment.getOrAddFragment(tag: String, commitNow: Boolean = true, initFun: () -> T): T = | |
childFragmentManager.findFragmentByTag(tag) as? T ?: run { | |
initFun().also { |
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
val singleParamUseCase = ... | |
// single execution (param is stubbed as "any()") | |
singleParamUseCase.stubObserver { | |
onSuccess("yay") | |
} | |
viewModel.triggerSomething() | |
singleParamUseCase.execute("some-param") |
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
# | |
# This file configures the static code analysis done by Detekt (https://arturbosch.github.io/detekt/index.html) | |
# | |
# Derivations from the defaults (https://github.com/arturbosch/detekt/blob/master/detekt-cli/src/main/resources/default-detekt-config.yml) | |
# are not listed here, unless we specifically voted on a rule to be used / not used. | |
# | |
# If adaptions to a default rule are made, the _complete_ configuration of that rule should be included here, not | |
# only the part that is actually overridden. This is important to see the rule in context. | |
# | |
# If you want to introduce changes to existing rules and / or want to introduce new rules, please use the |
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
java.lang.NoSuchMethodError: com.google.android.material.shape.MaterialShapeDrawable.<init>(Landroid/content/Context;Landroid/util/AttributeSet;II)V | |
at com.google.android.material.dialog.MaterialAlertDialogBuilder.<init>(MaterialAlertDialogBuilder.java:121) | |
at com.google.android.material.dialog.MaterialAlertDialogBuilder.<init>(MaterialAlertDialogBuilder.java:103) | |
at our.code.onCreate(OurFragment.kt:112) | |
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2684) | |
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280) | |
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1175) | |
at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1255) | |
at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1138) | |
at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:136) |
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
open class MyCodemarkerPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
val androidExtension = project.extensions.findByType(BaseExtension::class.java) | |
if (androidExtension != null) { | |
project.createCodemarkerTask { | |
sources.from(project.files(androidExtension.sourceSets.map { | |
it.java.srcDirs + it.assets.srcDirs + it.res.srcDirs + it.manifest.srcFile | |
})) | |
} | |
return |
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 com.android.build.gradle.BaseExtension | |
import com.android.build.gradle.api.BaseVariant | |
import com.android.build.gradle.internal.tasks.factory.dependsOn | |
import de.aaschmid.gradle.plugins.cpd.Cpd | |
import de.aaschmid.gradle.plugins.cpd.CpdExtension | |
import org.gradle.api.GradleException | |
import org.gradle.api.Plugin | |
import org.gradle.api.Project | |
import org.gradle.api.internal.HasConvention | |
import org.gradle.api.plugins.JavaPluginConvention |
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
val configuration = project.configurations.getByName("prodConsumerReleaseRuntimeClasspath") | |
val artifactType = Attribute.of("artifactType", String::class.java) | |
// Some plugin can only work with configurations, while the Android Gradle Plugin (AGP) has the newer "artifact view" | |
// paradigm implemented. This makes it impossible to resolve most of the created, variant-aware | |
// configurations from AGP "by hand" without getting unmatched attribute exceptions. | |
// We now pick one artifact that holds our dependencies and add a custom compatibility rule | |
// for it which basically accepts all incoming compatibility issues as long as the produced value | |
// on "the other side" is a JAR or AAR artifact. | |
configuration.attributes { | |
attribute(artifactType, "android-classes-directory") |
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 io.reactivex.rxjava3.core.Completable | |
import okhttp3.Interceptor | |
import okhttp3.Response | |
import okhttp3.mockwebserver.MockWebServer | |
import org.junit.Rule | |
import org.junit.Test | |
import retrofit2.Retrofit | |
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory | |
import retrofit2.http.POST |
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
[15:46:41] Welcome to Gradle 6.7! | |
[15:46:41] | |
[15:46:41] Here are the highlights of this release: | |
[15:46:41] - File system watching is ready for production use | |
[15:46:41] - Declare the version of Java your build requires | |
[15:46:41] - Java 15 support | |
[15:46:41] | |
[15:46:41] For more details see https://docs.gradle.org/6.7/release-notes.html | |
[15:46:41] | |
[15:46:41] To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7/userguide/gradle_daemon.html. |