Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
buildscript { | |
repositories { | |
mavenCentral() | |
maven { | |
url 'https://oss.sonatype.org/content/repositories/snapshots/' | |
} | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.9.+' | |
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT' |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
String getJavaHome(String version) | |
{ | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine "/usr/libexec/java_home", "-v", version | |
standardOutput = stdout; | |
} | |
return stdout.toString().trim() | |
} |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.support.design.widget.TextInputLayout; | |
import android.support.v4.view.ViewCompat; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.EditText; | |
public class CustomTextInputLayout extends TextInputLayout { |
RecyclerViewInteraction.<Item>onRecyclerView(withId(R.id.recyclerview)) | |
.withItems(items) | |
.check(new ItemViewAssertion<Item>() { | |
@Override | |
public void check(Item item, View view, NoMatchingViewException e) { | |
matches(hasDescendant(withText(item.getDisplayName()))) | |
.check(view, e); | |
} | |
}); |
/* | |
* Copyright (C) 2016 Jeff Gilfelt. | |
* | |
* 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 |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.ColorStateList; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.os.Build; | |
import android.text.Editable; | |
import android.util.AttributeSet; | |
import android.util.TypedValue; |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonObject; | |
import com.google.gson.JsonSerializationContext; | |
import com.google.gson.JsonSerializer; | |
import com.squareup.javapoet.*; | |
import javax.lang.model.element.Modifier; | |
import java.io.File; | |
import java.io.IOException; | |
import java.lang.reflect.Field; |