Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wmbest2 on github.
  • I am wmbest2 (https://keybase.io/wmbest2) on keybase.
  • I have a public key ASC4OJiOEDEqF34Y2pK4S39PjpbjlA7SCUAaQEzFXmqYego

To claim this, I am signing this object:

Reactive Forms with RxAndroid and TextInputLayout

Reactive Programming has been getting a lot of attention in the Android community lately. While it has uses throughout the application stack, we're going to focus here on using it to validate forms (exciting!). This approach cuts down on ugly nested if statements and transforms all of the validation logic to just a few simple lines using the RxJava framework. More, its robust and testable.

This post assumes some knowledge of how RxJava and lambdas work. If you need more of a refresher RxJava Retrolambda

Setup layout with TextInputLayout

@wmbest2
wmbest2 / backup_appdata
Created October 25, 2013 02:00
shell script for app backup
#!/bin/bash
adb backup -f /tmp/data.ab -noapk $1
dd if=/tmp/data.ab bs=1 skip=24 | /usr/local/Cellar/openssl/1.0.1e/bin/openssl zlib -d | tar -xvf -
rm /tmp/data.ab
@wmbest2
wmbest2 / example.html
Last active December 17, 2015 07:28
ctrl-click directive
<span ctrl-click="someFuncInMyController()">Hello World</span>
@wmbest2
wmbest2 / test-runner
Created March 23, 2012 15:48
Python script to generate test commands
#! /usr/bin/python
import curses
import sys
import os
runners = ["android.test.InstrumenationTestRunner"
, "pl.polidea.instrumentation.PolideaInstrumentationTestRunner"]
create = ["Add class", "Run Tests"]
@wmbest2
wmbest2 / change.sh
Created February 9, 2012 14:56
Command line to bulk change a Package Name
find . -name "*.java" | xargs perl -pi -e "s/com.vokal.XXX/com.vokal.YYY/g"
@wmbest2
wmbest2 / adb_install.sh
Created August 17, 2011 19:28 — forked from scottferg/adb_install.sh
Small shell script to easily deploy an Android debug build to all connected devices using adb
#!/bin/bash
file="bin/*-debug.apk"
uninstall=0
while getopts "ruf:" opt; do
case $opt in
r)
file="bin/*-release.apk"
;;
u)
uninstall=1
package com.vokal.petcheck.test;
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Intent;
import android.content.IntentFilter;
import android.test.ActivityInstrumentationTestCase2;
import android.test.TouchUtils;
import android.util.Log;
import android.view.KeyEvent;
@wmbest2
wmbest2 / LoginActivity.java
Created March 17, 2011 18:35
LoginActivity with persistant AsyncTasks
package com.vokal.petcheck;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wmbest.countdown"
android:versionCode="1"
android:versionName="1.0">
<application android:label="TEST WIDGET" android:icon="@drawable/icon">
<receiver android:name="CountdownWidget"
android:label="Jill's Widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />