Skip to content

Instantly share code, notes, and snippets.

View wisnukurniawan's full-sized avatar

Wisnu Kurniawan wisnukurniawan

View GitHub Profile
@wisnukurniawan
wisnukurniawan / build.gradle
Created July 26, 2019 15:00 — forked from gpeal/build.gradle
Airbnb Gradle Flavors
...
apply from: './flavors.gradle'
...
android {
buildTypes {
productFlavors {
project.flavors.each { flavor, config ->
"$flavor" {
dimension 'scope'
if (flavor != 'full') {
@wisnukurniawan
wisnukurniawan / README.md
Created November 13, 2018 10:27 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

class MyCustomTextView(ctx: Context) : MyCustomTextView(ctx), TextView
inline fun ViewManager.myCustomTextView(init: MyCustomTextView.() -> Unit = {})= ankoView({ MyCustomTextView(it) }, theme = 0, init)
linearLayout {
orientation = LinearLayout.VERTICAL
val myEdt = editText {
hint = "Name"
}.lparams(width = matchParent, height = wrapContent)
button("Say Hello") {
onClick {
val message = if (myEdt.text.toString().isBlank()) {
linearLayout {
orientation = LinearLayout.VERTICAL
editText {
hint = "Name"
}.lparams(width = matchParent, height = wrapContent)
button("Say Hello") {
}.lparams(width = matchParent, height = wrapContent)
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/main_root"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.wisnu.uicomponent.MainActivity">
<EditText
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
fun main(args: Array<String>) {
val data: MutableList<String> = mutableListOf("Andi", "Beni", "Deni", "Fani", "Gita")
Observable
.just(data)
.observeOn(Schedulers.io())
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
fun main(args: Array<String>) {
val data: MutableList<String> = mutableListOf("Andi", "Beni", "Deni", "Fani", "Gita") // Sumber data
val observer = object : Observer<MutableList<String>> { // Membuat observer
override fun onNext(p0: MutableList<String>) {
// Do something
@wisnukurniawan
wisnukurniawan / ViewBinder.java
Created July 23, 2017 05:04 — forked from yolapop/ViewBinder.java
Generic FastAdapter's AbstractItem to be used for all types of ViewHolders
/**
* Functional interface for binding data to a view
*/
public interface ViewBinder<V extends View> {
void bindView(V view, ViewItem<V> item);
}
@wisnukurniawan
wisnukurniawan / Pager.java
Created April 24, 2017 09:00 — forked from mttkay/Pager.java
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;