Demystify RxJava (2)

About Disposable

Guowei Lv

6 minute read

In this article, we focus on how the dispose system works in RxJava. First, let’s take a look at the Disposable interface. public interface Disposable { void dispose(); boolean isDisposed(); } Not much going on here, basically it says a Disposable can be disposed. First example we are going to examine is: Observable.interval(1, TimeUnit.SECONDS) If you click through the code, the implementation is actually this class ObservableInterval. First let’s look at the constructor of this class:

Demystify RxJava (1)

Get to know how RxJava works

Guowei Lv

3 minute read

Let’s see what makes RxJava tick. RxJava is complex, so I will have to (overly) simplify things at places. All of this is just trying to help you to get a better picture of how RxJava is implemented. Let’s go. Let’s start with the Single, it’s just an interface with one method: public interface Single<T> { void subscribe(SingleObserver<T> observer); } So a Single is just a thing that can be subscribed.

I wrote a game again - 24!

A classic poker math game

Guowei Lv

1 minute read

It all started from a message sent by my cousin in our family group chat one day. He posted some of those harder 24 problems, and I couldn’t solve any of them. (If you don’t know what is this 24 game is all about, here you can read it https://en.wikipedia.org/wiki/24_game) So, I decided to write a program to help me. And that program turned into a mobile game eventually.

Separating Program Evaluation From Description

Stream, Lazy, Map, Filter, EVAL

Guowei Lv

4 minute read

5.3 Separating program evaluation from description This is the title of Chapter 5.3 from the book Functional Programming in Kotlin. Everyone knows that a program is a list of instructions that will be executed/evaluated in the order they are written in. fun exec() { doThis() doThat() doMore() } So the description decides the evaluation. What does it mean to separate them? I mean, can they be different?

Handmade NestedScrollView

Understand how nested scrolling works in Android

Guowei Lv

3 minute read

I’m learning how the nested scrolling machanism works on Android, but couldn’t really find any in-depth material. So I turned into the Chinese community, and found this incredible article. It is very long and detailed to death, I don’t really have time to go through it all. I find the first half, a handmade SimpleNestedScrollView to be quite interesting, let me put that part in English here. Understand the problem If you have a ScrollView inside another ScrollView(same scrolling direction, both vertical or horizontal), then what to expect of the scrolling behaviour?