I hereby claim:
- I am radzio on github.
- I am radzio (https://keybase.io/radzio) on keybase.
- I have a public key ASCXQuDHoZ_wR4XsxPROEOYtzn38vcHRPNb2Msutwc6d-wo
To claim this, I am signing this object:
/* | |
Xively MQTT example | |
-Subscribes to Xively feed | |
-publishes current value to serial monitor | |
Based on Basic MQTT Example by knolleary | |
By Calum Barnes, Xively (c) 2013 |
apply plugin: 'java' | |
apply plugin: 'idea' | |
tasks.withType(JavaCompile) { | |
options.encoding = 'UTF-8' | |
} | |
configurations { | |
// pending http://jira.codehaus.org/browse/GRADLE-471 | |
providedCompile { description = 'Jars not to be included in the generated POM' } |
import android.app.Activity; | |
import android.app.Dialog; | |
import android.content.DialogInterface; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.v4.app.DialogFragment; | |
import android.support.v7.app.AlertDialog; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.widget.Button; |
I hereby claim:
To claim this, I am signing this object:
public static class MainViewModel { | |
public ObservableField<String> firstName = new ObservableField<>(); | |
public ObservableField<String> lastName = new ObservableField<>(); | |
public ObservableField<String> helloText = new ObservableField<>(); | |
public ObservableBoolean helloButtonEnabled = new ObservableBoolean(false); | |
public MainViewModel() { | |
Observable.combineLatest(toObservable(firstName), toObservable(lastName), (firstName, lastName) -> StringUtils.isNotNullOrEmpty(firstName) && StringUtils.isNotNullOrEmpty(lastName)) |
public class MainViewModelTests { | |
@Test | |
public void mainViewModel_firstName_lastName_helloButtonEnabledSetToTrue() throws Exception { | |
MainViewModel mainViewModel = new MainViewModel(); | |
assertFalse(mainViewModel.helloButtonEnabled.get()); | |
mainViewModel.firstName.set("a"); | |
mainViewModel.lastName.set("b"); |
public static <T> Observable<T> toObservable(@NonNull final ObservableField<T> observableField) { | |
return Observable.create(new Observable.OnSubscribe<T>() { | |
@Override | |
public void call(final Subscriber<? super T> subscriber) { | |
if (!subscriber.isUnsubscribed()) { | |
subscriber.onNext(observableField.get()); | |
} | |
final OnPropertyChangedCallback callback = new OnPropertyChangedCallback() { |