|
|
|
@ -13,18 +13,26 @@ inline fun <reified EVENT> postEvent(tag: String, event: EVENT) { |
|
|
|
|
return LiveEventBus.get().with(tag, EVENT::class.java).post(event) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline fun <reified EVENT> AppCompatActivity.observeEvent(tag: String, observer: Observer<EVENT>) { |
|
|
|
|
return eventObservable<EVENT>(tag).observe(this, observer) |
|
|
|
|
inline fun <reified EVENT> AppCompatActivity.observeEvent(tag: String, crossinline observer: (EVENT) -> Unit) { |
|
|
|
|
return eventObservable<EVENT>(tag).observe(this, Observer { |
|
|
|
|
observer(it) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline fun <reified EVENT> AppCompatActivity.observeEventSticky(tag: String, observer: Observer<EVENT>) { |
|
|
|
|
return eventObservable<EVENT>(tag).observeSticky(this, observer) |
|
|
|
|
inline fun <reified EVENT> AppCompatActivity.observeEventSticky(tag: String, crossinline observer: (EVENT) -> Unit) { |
|
|
|
|
return eventObservable<EVENT>(tag).observeSticky(this, Observer { |
|
|
|
|
observer(it) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline fun <reified EVENT> Fragment.observeEvent(tag: String, observer: Observer<EVENT>) { |
|
|
|
|
return eventObservable<EVENT>(tag).observe(this, observer) |
|
|
|
|
inline fun <reified EVENT> Fragment.observeEvent(tag: String, crossinline observer: (EVENT) -> Unit) { |
|
|
|
|
return eventObservable<EVENT>(tag).observe(this, Observer { |
|
|
|
|
observer(it) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline fun <reified EVENT> Fragment.observeEventSticky(tag: String, observer: Observer<EVENT>) { |
|
|
|
|
return eventObservable<EVENT>(tag).observeSticky(this, observer) |
|
|
|
|
inline fun <reified EVENT> Fragment.observeEventSticky(tag: String, crossinline observer: (EVENT) -> Unit) { |
|
|
|
|
return eventObservable<EVENT>(tag).observeSticky(this, Observer { |
|
|
|
|
observer(it) |
|
|
|
|
}) |
|
|
|
|
} |