Skip to content

Instantly share code, notes, and snippets.

View intrications's full-sized avatar

Michael Basil intrications

View GitHub Profile
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryPlugin
subprojects {
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
it.afterEvaluate { subProject ->
// is this a library or an app?
if(subProject.plugins.hasPlugin(AppPlugin.class) || subProject.plugins.hasPlugin(LibraryPlugin.class)) {
@arriolac
arriolac / AutoNextTextWatcher.java
Last active August 29, 2015 13:57
TextWatcher that will proceed to the next focusable view once the specified length has been reached
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
/**
* Created by chris on 3/13/14.
*/
public class AutoNextTextWatcher implements TextWatcher {
@arriolac
arriolac / AlphaImageButton.java
Created March 26, 2014 18:36
AlphaImageButton - auto shows disabled state on an ImageButton.
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;
public class AlphaImageButton extends ImageButton {
private static final float ENABLED_ALPHA = 1.0f;
private static final float DISABLED_ALPHA = 0.5f;
public AlphaImageButton(Context context) {
@rock3r
rock3r / WidgetHelper.java
Last active August 29, 2015 13:57
How to update an homescreen widget (the right way)
package net.frakbot.gists.widgethelper;
/*
* Copyright 2014 Sebastiano Poggi
*
* 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
@blundell
blundell / WatchFaceLifecycle-ExampleActivity.java
Last active August 29, 2015 14:03
Unofficial Base WatchFace Listener
public class ExampleActivity extends Activity implements WatchFaceLifecycle.Listener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_layout);
WatchFaceLifecycle.attach(this, savedInstanceState, this);
}
@Override
@blundell
blundell / 0-AdMobPokerExampleActivity.java
Last active August 29, 2015 14:04
Google Play Services AdMob loader - boiler plater saver
public class AdMobPokerExampleActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdMobPoker.track(findViewById(R.id.adView), savedInstanceState);
}
@tiwiz
tiwiz / Generator.java
Last active August 29, 2015 14:05
This class provides the essential implementation of ZXing library in order to generate a QR Code with custom foreground and background color and specified size.
import android.graphics.Bitmap;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
/**
* This class contains a single method that will generate a QR Code
* with given text, foreground and background color, and dimension of the side
import android.content.res.AssetManager;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import rx.Observable;
public class AssetsReader {
private final Gson gson;
private final AssetManager assetManager;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- RED -->
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
<color name="red_400">#EF5350</color>
<color name="red_500">#F44336</color>
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"