View vim solarized in iTerm2
# .profile
export TERM=xterm-256color
# .vimrc
syntax on
set background = dark
let g:solarized_termcolors = 256
colorscheme solarized
View ComplicatedEmailStream.java
Observable<Boolean> emailStream = RxTextView.textChanges(etEmail)
.map(new Func1<CharSequence, String>() {
@Override
public String call(CharSequence charSequence) {
return charSequence.toString();
}
})
.filter(new Func1<String, Boolean>() {
@Override
public Boolean call(String input) {
View map.java
.debounce(100,TimeUnit.MILLISECONDS)
.map(new Func1<String, Boolean>() {
@Override
public Boolean call(String s) {
// butuh fungsi yang me-return boolean
}
});
View PasswordStream.java
// Return true jika password yang diketik user < 6 karakter
Observable<Boolean> passwordStream = RxTextView.textChanges(etPassword)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return !TextUtils.isEmpty(charSequence)
&& charSequence.toString().trim().length() < 6;
}
});
View CheckIfEmailExistFromAPI.java
// Ambil daftar email dari APi, kemudian cek apakah email user sudah dipakai
public Observable<Boolean> checkIfEmailExistFromAPI(final String input){
return service.getEmails()
.flatMap(new Func1<List<String>, Observable<String>>() { // Mengubah stream of List<String> menjadi stream of String
@Override
public Observable<String> call(List<String> strings) {
return Observable.from(strings);
}
}).contains(input) // Cek apakah email di emit oleh stream sebelumnya
.subscribeOn(Schedulers.newThread())
View MultipleTapDemoActivity.java
package com.rohmanhakim.androidreactivedemo;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
View RxRegistrationDemoActivity.java
package com.rohmanhakim.androidreactivedemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
View ButtonSubmitValidation.java
Observable<Boolean> emptyFieldStream = Observable.combineLatest(
RxTextView.textChanges(etEmail)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
RxTextView.textChanges(etPassword)
.map(new Func1<CharSequence, Boolean>() {
View InvalidFieldsStream.java
Observable<Boolean> invalidFieldsStream = Observable.combineLatest(
emailStream,
passwordStream,
passwordConfirmationStream,
emptyFieldStream, new Func4<Boolean, Boolean, Boolean, Boolean, Boolean>() {
@Override
public Boolean call(Boolean emailInvalid, Boolean passwordInvalid, Boolean passwordConfirmationInvalid, Boolean emptyFieldExist) {
return !emailInvalid && !passwordInvalid && !passwordConfirmationInvalid && !emptyFieldExist;
}
});
View EmptyFieldStream.java
Observable<Boolean> emptyFieldStream = Observable.combineLatest(
RxTextView.textChanges(etEmail)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
RxTextView.textChanges(etPassword)
.map(new Func1<CharSequence, Boolean>() {