From 71a0e9d8badf1a2a4d4e2065cabfec1fbae9d212 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 17 Nov 2016 13:52:52 +0800 Subject: [PATCH] Add more details --- README.md | 20 +++++++++++++------- build.gradle | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5006ffa..44501fb 100644 --- a/README.md +++ b/README.md @@ -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 + @@ -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" @@ -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) -####2. 使用 subscribeOn(Schedulers.io())设置被观察者的线程 + +#### 2. 使用 subscribeOn(Schedulers.io())设置被观察者的线程 -Put it down to other Threads but Not Main Thread + + > 以下几个例子中看不出被观察者发生在什么线程,使用Observeble.create()创建被观察者可以看出发生在什么线程,可参看源码中的其它Demo。 -####3. 使用 subscribeOn(Schedulers.io()) 和 observeOn() 设置被观察者和观察者的线程 +#### 3. 使用 subscribeOn(Schedulers.io()) 和 observeOn() 设置被观察者和观察者的线程 -####4. 使用Schedulers.io()指定被观察者产生事件的线程,然后使用Map对数据转换,这里只是在每个数据后面加‘a’。 +#### 4. 使用Schedulers.io()指定被观察者产生事件的线程,然后使用Map对数据转换,这里只是在每个数据后面加‘a’。 -####5. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,输出结果。 +#### 5. 使用Schedulers.io()指定被观察者产生事件的线程,使用Map对数据转换,在每个数据后面加‘a’,使用AndroidSchedulers.mainThread()切换到主线程,然后使用Map变换,每个数据后加‘b’,输出结果。 -####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’,输出结果。 diff --git a/build.gradle b/build.gradle index 5a80b7d..033831f 100644 --- a/build.gradle +++ b/build.gradle @@ -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