All Projects → AndroidKnife → Rxbus

AndroidKnife / Rxbus

Licence: apache-2.0
Event Bus By RxJava.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Rxbus

Android Clean Architecture Boilerplate
Apply clean architecture on Android
Stars: ✭ 141 (-93.37%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxbluetooth
Android reactive bluetooth
Stars: ✭ 405 (-80.95%)
Mutual labels:  rxjava, rxjava2, rxandroid
Swipe
👉 detects swipe events on Android
Stars: ✭ 324 (-84.76%)
Mutual labels:  rxjava, rxjava2, rxandroid
Prefser
Wrapper for Android SharedPreferences with object serialization and RxJava Observables
Stars: ✭ 228 (-89.28%)
Mutual labels:  rxjava, rxjava2, rxandroid
Mvvm Architecture Android Beginners
This repository contains a sample app that implements MVVM architecture using Kotlin, ViewModel, LiveData, and etc.
Stars: ✭ 176 (-91.72%)
Mutual labels:  rxjava, rxjava2, rxandroid
ReactiveBus
🚍 Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
Stars: ✭ 17 (-99.2%)
Mutual labels:  rxjava, rxandroid, rxjava2
Rxbus
🚌 The RxBus as steady as an old dog.
Stars: ✭ 334 (-84.29%)
Mutual labels:  rxjava, rxjava2, rxandroid
Androidbasemvp
🚀一个快速搭建MVP+RxJava2+Retrofit 基础框架,主要是封装有Http网络请求、日志、缓存、加载等待、toast、页面状态布局管理、权限、RxBus、Glide图片加载等组件,方便快速开发新项目、减少开发成本。
Stars: ✭ 184 (-91.35%)
Mutual labels:  rxjava, rxjava2, rxandroid
Reactivebeacons
Android library scanning BLE beacons nearby with RxJava
Stars: ✭ 171 (-91.96%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxjava2 Operators Magician
你用不惯 RxJava,只因缺了这把钥匙 🔑 You are not used to RxJava, just because of the lack of this key.
Stars: ✭ 868 (-59.17%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxjavapriorityscheduler
RxPS - RxJavaPriorityScheduler - A RxJava Priority Scheduler library for Android and Java applications
Stars: ✭ 138 (-93.51%)
Mutual labels:  rxjava, rxjava2, rxandroid
Mvpframes
整合大量主流开源项目并且可高度配置化的 Android MVP 快速集成框架,支持 AndroidX
Stars: ✭ 100 (-95.3%)
Mutual labels:  rxjava, rxjava2, rxandroid
Reactivenetwork
Android library listening network connection state and Internet connectivity with RxJava Observables
Stars: ✭ 2,484 (+16.84%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxbiometric
☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android
Stars: ✭ 295 (-86.12%)
Mutual labels:  rxjava, rxjava2, rxandroid
Reactivewifi
Android library listening available WiFi Access Points and related information with RxJava Observables
Stars: ✭ 186 (-91.25%)
Mutual labels:  rxjava, rxjava2, rxandroid
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (-84.67%)
Mutual labels:  rxjava, rxjava2, rxandroid
Rxjava2 Android Samples
RxJava 2 Android Examples - Migration From RxJava 1 to RxJava 2 - How to use RxJava 2 in Android
Stars: ✭ 4,950 (+132.83%)
Mutual labels:  rxjava, rxjava2, rxandroid
Aiyagirl
🔥 爱吖妹纸(含 Kotlin 分支版本)——Retrofit + RxJava + MVP 架构 APP 体验代码家的干货集中营 Gank.io,福利多多,不容错过
Stars: ✭ 1,109 (-47.84%)
Mutual labels:  rxjava, rxjava2, rxandroid
Reactivesensors
Android library monitoring device hardware sensors with RxJava
Stars: ✭ 161 (-92.43%)
Mutual labels:  rxjava, rxjava2, rxandroid
Vertx Rx
Reactive Extensions for Vert.x
Stars: ✭ 137 (-93.56%)
Mutual labels:  rxjava, rxjava2

RxBus - An event bus by ReactiveX/RxJava/ReactiveX/RxAndroid

This is an event bus designed to allowing your application to communicate efficiently.

I have use it in many projects, and now i think maybe someone would like it, so i publish it.

RxBus support annotations(@produce/@subscribe), and it can provide you to produce/subscribe on other thread like MAIN_THREAD, NEW_THREAD, IO, COMPUTATION, TRAMPOLINE, IMMEDIATE, even the EXECUTOR and HANDLER thread, more in EventThread.

Also RxBus provide the event tag to define the event. The method's first (and only) parameter and tag defines the event type.

Thanks to:

square/otto

greenrobot/EventBus

Usage

Just 2 Steps:

STEP 1

Add dependency to your gradle file:

compile 'com.hwangjr.rxbus:rxbus:3.0.0'

Or maven:

<dependency>
  <groupId>com.hwangjr.rxbus</groupId>
  <artifactId>rxbus</artifactId>
  <version>3.0.0</version>
  <type>aar</type>
</dependency>

TIP: Maybe you also use the JakeWharton/timber to log your message, you may need to exclude the timber (from version 1.0.4, timber dependency update from AndroidKnife/Utils/timber to JakeWharton):

compile ('com.hwangjr.rxbus:rxbus:3.0.0') {
    exclude group: 'com.jakewharton.timber', module: 'timber'
}

en Snapshots of the development version are available in Sonatype's snapshots repository.

STEP 2

Just use the provided(Any Thread Enforce):

com.hwangjr.rxbus.RxBus

Or make RxBus instance is a better choice:

public static final class RxBus {
    private static Bus sBus;
    
    public static synchronized Bus get() {
        if (sBus == null) {
            sBus = new Bus();
        }
        return sBus;
    }
}

Add the code where you want to produce/subscribe events, and register and unregister the class.

public class MainActivity extends AppCompatActivity {
    ...
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
        RxBus.get().register(this);
        ...
    }
    
    @Override
    protected void onDestroy() {
        ...
        RxBus.get().unregister(this);
        ...
    }
        
    @Subscribe
    public void eat(String food) {
        // purpose
    }
        
    @Subscribe(
        thread = EventThread.IO,
        tags = {
            @Tag(BusAction.EAT_MORE)
        }
    )
    public void eatMore(List<String> foods) {
        // purpose
    }
    
    @Produce
    public String produceFood() {
        return "This is bread!";
    }
    
    @Produce(
        thread = EventThread.IO,
        tags = {
            @Tag(BusAction.EAT_MORE)
        }
    )
    public List<String> produceMoreFood() {
        return Arrays.asList("This is breads!");
    }
    
    public void post() {
        RxBus.get().post(this);
    }
    
    public void postByTag() {
        RxBus.get().post(Constants.EventType.TAG_STORY, this);
    }
    ...
}

That is all done!

Lint

Features

  • JUnit test
  • Docs

History

Here is the CHANGELOG.

FAQ

Q: How to do pull requests?
A: Ensure good code quality and consistent formatting.

License

Copyright 2015 HwangJR, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].