-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
72 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Mon Dec 28 10:00:20 PST 2015 | ||
#Fri Apr 13 19:19:31 CST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 16 additions & 14 deletions
30
mvp/src/main/java/cn/droidlover/xdroidmvp/event/RxBusImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,53 @@ | ||
package cn.droidlover.xdroidmvp.event; | ||
|
||
|
||
import io.reactivex.Flowable; | ||
import io.reactivex.processors.FlowableProcessor; | ||
import io.reactivex.processors.PublishProcessor; | ||
import com.blankj.rxbus.RxBus; | ||
|
||
/** | ||
* Created by wanglei on 2016/12/22. | ||
*/ | ||
|
||
public class RxBusImpl implements IBus { | ||
|
||
private FlowableProcessor<Object> bus = null; | ||
|
||
private RxBusImpl() { | ||
bus = PublishProcessor.create().toSerialized(); | ||
} | ||
|
||
public static RxBusImpl get() { | ||
return Holder.instance; | ||
} | ||
|
||
@Override | ||
public void register(Object object) { | ||
|
||
} | ||
|
||
@Override | ||
public void unregister(Object object) { | ||
|
||
RxBus.getDefault().unregister(object); | ||
} | ||
|
||
@Override | ||
public void post(IEvent event) { | ||
bus.onNext(event); | ||
RxBus.getDefault().post(event); | ||
} | ||
|
||
@Override | ||
public void postSticky(IEvent event) { | ||
RxBus.getDefault().postSticky(event); | ||
} | ||
|
||
public <T> void subscribe(Object subscriber, | ||
RxBus.Callback<T> callback) { | ||
RxBus.getDefault().subscribe(subscriber, callback); | ||
} | ||
|
||
public <T> void subscribeSticky(Object subscriber, | ||
RxBus.Callback<T> callback) { | ||
RxBus.getDefault().subscribeSticky(subscriber, callback); | ||
} | ||
|
||
public <T extends IEvent> Flowable<T> toFlowable(Class<T> eventType) { | ||
return bus.ofType(eventType).onBackpressureBuffer(); | ||
public static RxBusImpl get() { | ||
return Holder.instance; | ||
} | ||
|
||
private static class Holder { | ||
private static final RxBusImpl instance = new RxBusImpl(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters