Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProGuard 怎么写 #4

Open
a1b22003001 opened this issue Dec 29, 2016 · 1 comment
Open

ProGuard 怎么写 #4

a1b22003001 opened this issue Dec 29, 2016 · 1 comment

Comments

@a1b22003001
Copy link

-keep class com.yan.rxbus.**{*;} 无法能功能正常使用

@genius158
Copy link
Owner

不好意思,由于rxjava已经升级为2.x,在实际项目中也并不会这样使用,所以我已经放弃了该库的维护,所以也没有再关注过这个库。

关于2.x以后的rxbus 参考
public final class RxBus {
private static RxBus instance;

private Subject<Object> bus;

public static RxBus getInstance() {
    if (instance == null) {
        instance = new RxBus();
    }
    return instance;
}

private RxBus() {
    if (bus == null) {
        synchronized (RxBus.class) {
            if (bus == null) {
                bus = PublishSubject.create().toSerialized();
            }
        }
    }
}

public void post(Object event) {
    bus.toSerialized().onNext(event);
}

public <T> Observable<T> getEvent(Class<T> eventType) {
    return  bus.toSerialized().ofType(eventType);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants