Skip to content

Instantly share code, notes, and snippets.

View WarrenFaith's full-sized avatar

Martin Breuer WarrenFaith

  • sennder GmbH
  • Germany
View GitHub Profile
@WarrenFaith
WarrenFaith / build.gradle
Last active March 11, 2019 11:33
Basic script setup to add tasks like "testDebugUnitTestCoverage" (when you have no flavors defined) or "testFlavorNameDebugUnitTestCoverage" (replace FlavorName with your flavor name). Limitation: Does not work with flavor dimensions!
// in your root gradle file:
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
}
public class RxAccountBus {
private final static RxAccountBus INSTANCE = new RxAccountBus();
public final static int ACCOUNT_LOGGED_IN = 0;
public final static int ACCOUNT_LOGGED_OUT = 1;
public final static int ACCOUNT_DATA_UPDATED = 2;
@Retention(SOURCE)
@IntDef({ACCOUNT_LOGGED_IN, ACCOUNT_LOGGED_OUT, ACCOUNT_DATA_UPDATED})
public @interface Account {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BuildConfig.API_BITCOIN_BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
@WarrenFaith
WarrenFaith / filter_devices.groovy
Created February 3, 2016 13:51 — forked from Ghedeon/filter_devices.groovy
Android Gradle (1.3.0-beta4). Filter multiple devices
project.afterEvaluate {
project.("connectedDebugAndroidTest").doFirst {
def originalProvider = deviceProvider
deviceProvider = [
getName : { originalProvider.getName() },
init : { originalProvider.init() },
terminate : { originalProvider.terminate() },
getDevices : { filterDevices(originalProvider.getDevices()) },
getTimeoutInMs: { originalProvider.getTimeoutInMs() },
isConfigured : { originalProvider.isConfigured() },