Skip to content

Add more details #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ The most simply explain one in my mind is

2 " Here is what will happen next"

**Why:** It makes you code 10x faster than whatever you are right now
**Why:** Whenever we deal with http request or anything that cannt be done rigth the way. We need something to manage "When" will it be done




Expand All @@ -31,6 +32,8 @@ To define the "time" of something happen, we need a "Scheduler",

To define the "things happen" of something happen, we need a "Thread"

To define the "things happen right now" is Main Threads and other Thread treat as background Threads

1. `Schedulers.immediate()` 在当前线程运行,相当于不切换线程。这是默认的 Scheduler。

**Explain:** Read as "Do it Right now"
Expand Down Expand Up @@ -60,36 +63,39 @@ To define the "things happen" of something happen, we need a "Thread"
> This example show how to use make a few threads that we can watch their actions


####1. 基本使用
#### 1. 基本使用(Simply way to monitor the Threads)
<img src="screenshots/just.png" width="61%" />
<img src="screenshots/just.gif" width="34%" />
<img src="screenshots/justp.png" width="96%" />
####2. 使用 subscribeOn(Schedulers.io())设置被观察者的线程

#### 2. 使用 subscribeOn(Schedulers.io())设置被观察者的线程 -Put it down to other Threads but Not Main Thread

<img src="screenshots/just1.png" width="61%" />
<img src="screenshots/just1.gif" width="34%" />
<img src="screenshots/just1p.png" width="96%" />

> 以下几个例子中看不出被观察者发生在什么线程,使用Observeble.create()创建被观察者可以看出发生在什么线程,可参看源码中的其它Demo。

####3. 使用 subscribeOn(Schedulers.io()) 和 observeOn() 设置被观察者和观察者的线程
#### 3. 使用 subscribeOn(Schedulers.io()) 和 observeOn() 设置被观察者和观察者的线程

<img src="screenshots/just2.png" width="61%" />
<img src="screenshots/just2.gif" width="34%" />
<img src="screenshots/just2p.png" width="96%" />

####4. 使用Schedulers.io()指定被观察者产生事件的线程,然后使用Map对数据转换,这里只是在每个数据后面加‘a’。
#### 4. 使用Schedulers.io()指定被观察者产生事件的线程,然后使用Map对数据转换,这里只是在每个数据后面加‘a’。

<img src="screenshots/just3.png" width="61%" />
<img src="screenshots/just3.gif" width="34%" />
<img src="screenshots/just3p.png" width="96%" />


####5. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,输出结果。
#### 5. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,输出结果。

<img src="screenshots/just4.png" width="61%" />
<img src="screenshots/just4.gif" width="34%" />
<img src="screenshots/just4p.png" width="96%" />

####6. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,再用Schedulers.io()切换线程,用Map对数据加‘c’,输出结果。
#### 6. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,再用Schedulers.io()切换线程,用Map对数据加‘c’,输出结果。

<img src="screenshots/just5.png" width="61%" />
<img src="screenshots/just5.gif" width="34%" />
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down