I hereby claim:
- I am JakeWharton on github.
- I am jakewharton (https://keybase.io/jakewharton) on keybase.
- I have a public key whose fingerprint is 90EE 1978 7A7B CF6F D37A 1E91 80C0 8B1C 2910 0955
To claim this, I am signing this object:
import com.google.auto.value.AutoValue; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.Target; | |
import static java.lang.annotation.ElementType.TYPE; | |
import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
/** | |
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization. | |
* <p> |
I hereby claim:
To claim this, I am signing this object:
This gist has graduated to a full-fledged repo @ https://github.com/JakeWharton/ProcessPhoenix
allprojects { | |
afterEvaluate { project -> | |
project.configurations.all { | |
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | |
def requested = details.requested | |
if (requested.version.contains('+')) { | |
throw new GradleException("Wildcard dependency forbidden: ${requested.group}:${requested.name}:${requested.version}") | |
} | |
} | |
} |
This test rule is now in the 'test-rules' support repository. Use that one!
https://developer.android.com/reference/android/support/test/rule/ActivityTestRule.html
/** | |
* Show the activity over the lockscreen and wake up the device. If you launched the app manually | |
* both of these conditions are already true. If you deployed from the IDE, however, this will | |
* save you from hundreds of power button presses and pattern swiping per day! | |
*/ | |
public static void riseAndShine(Activity activity) { | |
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED); | |
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE); | |
PowerManager.WakeLock lock = |
/* | |
* Copyright (C) 2015 Jake Wharton | |
* | |
* 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 |
def installAll = tasks.create('installAll') | |
installAll.description = 'Install all applications.' | |
android.applicationVariants.all { variant -> | |
installAll.dependsOn(variant.install) | |
// Ensure we end up in the same group as the other install tasks. | |
installAll.group = variant.install.group | |
} |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
/** Got flaky tests? Shampoo them away. */ | |
public final class ShampooRule implements TestRule { | |
private final int iterations; | |
public ShampooRule(int iterations) { | |
if (iterations < 1) throw new IllegalArgumentException("iterations < 1: " + iterations); |
/* | |
* Copyright (C) 2015 Jake Wharton | |
* | |
* 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 |