GeezerVison is showing github.com — Replaced RxJava1 RxRelay with RxJava2 version · codeteo/RxJava-Android-Samples@9877c7f
File tree
Expand file treeCollapse file tree
Open diff view settings
src/main/java/com/morihacky/android/rxjava/rxbus
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: app/build.gradle +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ dependencies { |
51 | 51 | compile "com.github.akarnokd:rxjava2-interop:0.6.1" |
52 | 52 |
|
53 | 53 | compile 'io.reactivex:rxjava-math:1.0.0' |
54 | | - compile 'com.jakewharton.rxrelay:rxrelay:1.2.0' |
| 54 | + compile 'com.jakewharton.rxrelay2:rxrelay:2.0.0' |
55 | 55 | compile 'com.jakewharton.rxbinding:rxbinding:0.2.0' |
56 | 56 | compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' |
57 | 57 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/rxbus/RxBus.java +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | package com.morihacky.android.rxjava.rxbus; |
2 | 2 |
|
3 | | -import com.jakewharton.rxrelay.PublishRelay; |
4 | | -import com.jakewharton.rxrelay.Relay; |
5 | | -import hu.akarnokd.rxjava.interop.RxJavaInterop; |
| 3 | +import com.jakewharton.rxrelay2.PublishRelay; |
| 4 | +import com.jakewharton.rxrelay2.Relay; |
| 5 | + |
| 6 | +import io.reactivex.BackpressureStrategy; |
6 | 7 | import io.reactivex.Flowable; |
7 | 8 |
|
8 | 9 | /** |
9 | 10 | * courtesy: https://gist.github.com/benjchristensen/04eef9ca0851f3a5d7bf |
10 | 11 | */ |
11 | 12 | public class RxBus { |
12 | 13 |
|
13 | | - private final Relay<Object, Object> _bus = PublishRelay.create().toSerialized(); |
| 14 | + private final Relay<Object> _bus = PublishRelay.create().toSerialized(); |
14 | 15 |
|
15 | 16 | public void send(Object o) { |
16 | | - _bus.call(o); |
| 17 | + _bus.accept(o); |
17 | 18 | } |
18 | 19 |
|
19 | 20 | public Flowable<Object> asFlowable() { |
20 | | - // this won't be necessary after https://github.com/JakeWharton/RxRelay/pull/20 is complete |
21 | | - return RxJavaInterop.toV2Flowable(_bus.asObservable()); |
| 21 | + return _bus.toFlowable(BackpressureStrategy.LATEST); |
22 | 22 | } |
23 | 23 |
|
24 | 24 | public boolean hasObservers() { |
|