Skip to content

Instantly share code, notes, and snippets.

View rmakiyama's full-sized avatar
🚀
Mobile app engineer

Ryo Makiyama rmakiyama

🚀
Mobile app engineer
View GitHub Profile
@rmakiyama
rmakiyama / DebounceTest.kt
Created October 4, 2018 13:18 — forked from k-kagurazaka/DebounceTest.kt
RxJava debounce like operator implementation for kotlin coroutine
launch(UI) {
editText.onTextChanged()
.debounce(1, TimeUnit.SECONDS)
.consumeEach {
Log.d("DebounceTest", "value: $it")
}
}
}
fun EditText.onTextChanged(): ReceiveChannel<String> =
@rmakiyama
rmakiyama / DebounceTest.kt
Created October 4, 2018 13:18 — forked from k-kagurazaka/DebounceTest.kt
RxJava debounce like operator implementation for kotlin coroutine
launch(UI) {
editText.onTextChanged()
.debounce(1, TimeUnit.SECONDS)
.consumeEach {
Log.d("DebounceTest", "value: $it")
}
}
}
fun EditText.onTextChanged(): ReceiveChannel<String> =
@rmakiyama
rmakiyama / DrawableImageView.java
Created March 8, 2018 03:11
カスタムViewの処女作が不要になったので供養のためGistに埋めます。
/**
* Created by rmakiyama on 2017/02/23.
* drawable image view
*/
@SuppressWarnings("unused")
public class DrawableImageView extends View {
private static final Paint.Style[] mStyles = Paint.Style.values();
private static final Paint.Cap[] mCaps = Paint.Cap.values();
private static final Paint.Join[] mJoins = Paint.Join.values();
@BindingAdapter("setDrawableTint")
fun ImageView.setDrawableTint(color: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.imageTintList = ColorStateList.valueOf(color)
} else {
this.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
}
}