Skip to content

Instantly share code, notes, and snippets.

View fejd's full-sized avatar

Fredrik Henricsson fejd

View GitHub Profile
@fejd
fejd / build.gradle
Created October 26, 2016 14:23
Treat Java unchecked and deprecation warnings as errors
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
@fejd
fejd / build.gradle
Last active February 6, 2020 09:20
Gradle task for running checkstyle on changed files only
checkstyle {
toolVersion = "7.0"
ignoreFailures = true
configFile rootProject.file("checkstyle/checkstyle.xml")
configProperties = [ "checkstyleFilterFile" : file('checkstyle/filter.xml')]
}
task checkstyleChanged(type: Checkstyle, dependsOn: 'copyChangedFilesForCheckstyle') {
source 'changedfiles'
include '**/*.java'
@fejd
fejd / MainActivity.java
Created September 20, 2016 12:55
Android URL unfurling example
package com.example.unfurl;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
@fejd
fejd / EspressoSuite.java
Last active September 21, 2016 08:28
An example of using @ClassRule to set up the device to disable animations before running Espresso tests
// Example of disabling animations and restoring after a suite has finished
// SystemAnimations.java -> https://github.com/reark/reark/blob/master/app/src/androidTest/java/io/reark/rxgithubapp/activities/utils/SystemAnimations.java
import org.junit.ClassRule;
import org.junit.rules.ExternalResource;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)