Skip to content

Instantly share code, notes, and snippets.

@mr-archano
mr-archano / howto.md
Created February 13, 2016 15:09 — forked from neworld/howto.md
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: 'com.android.application'

android {
 compileSdkVersion 23
@mr-archano
mr-archano / AccountAuthenticator.java
Created January 16, 2016 11:40 — forked from burgalon/AccountAuthenticator.java
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
@mr-archano
mr-archano / Android Lollipop Widget Tinting Guide
Last active August 29, 2015 14:25 — forked from seanKenkeremath/Android Lollipop Widget Tinting Guide
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@mr-archano
mr-archano / GradleWorkersPleaseStopTakingFocus.gradle
Last active August 29, 2015 14:25 — forked from artem-zinnatullin/GradleWorkersPleaseStopTakingFocus.gradle
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
}
}
@mr-archano
mr-archano / giffify.sh
Last active August 29, 2015 14:24 — forked from rock3r/giffify.py
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
#
# Based upon http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
@mr-archano
mr-archano / JavaAptPlugin
Created July 11, 2015 20:14
APT plugin for plain Java modules
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.tooling.BuildException
class JavaAptPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
def aptConfiguration = project.configurations.create 'javapt'
@mr-archano
mr-archano / gist:6929c2eb002c24eb9f8f
Created May 22, 2015 13:10
Thread safe SimpleDateFormat wrapper
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class SimpleDateFormatThreadSafe {
private final ThreadLocal<SimpleDateFormat> localSimpleDateFormat;
@mr-archano
mr-archano / build.log
Created January 19, 2015 11:15
NewRelic + Crashlytics = B O O M !
:android:newRelicDeinstrumentTask
[newrelic.info] Deinstrumenting...
:android:crashlyticsStoreDeobsAlphaDebug
:android:crashlyticsUploadDeobsAlphaDebug
:android:crashlyticsCleanupResourcesAfterUploadAlphaDebug
...removing crashlytics.properties
:android:compileAlphaDebugNdk
:android:processAlphaDebugJavaRes UP-TO-DATE
:android:validateDebugSigning
:android:packageAlphaDebug
@mr-archano
mr-archano / 0. Auto unsubscribe facilities
Last active August 29, 2015 14:10
I didn't want to pollute the discussion started in RxAndroid/#12 (https://github.com/ReactiveX/RxAndroid/issues/12), so I drafted a solution that collects some of the neat ideas showcased in there.
// NOTE: `OperatorSubscribeUntil` class is borrowed from @dlew's PR (https://github.com/dlew/RxAndroid/blob/dlew/lifecycle-observable/rxandroid/src/main/java/rx/android/lifecycle/OperatorSubscribeUntil.java)
@mr-archano
mr-archano / root project build.gradle
Last active January 14, 2016 21:43
The idea is to create an android test module (eg: `tests`) with a dependency on the main android module (eg: `app`). With a little setup you can easily run unit tests (in your `tests/androidTest` folder) on the JVM and hava JaCoCo reports altogether.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}