34 lines
878 B
Java
34 lines
878 B
Java
package com.android.eventbaus;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
public class EventBusUtils {
|
|
|
|
|
|
|
|
public static void registerEventBus(Object subscriber){
|
|
if(!EventBus.getDefault().isRegistered(subscriber)){
|
|
EventBus.getDefault().register(subscriber);
|
|
}
|
|
}
|
|
|
|
public static void unRegisterEventBus(Object subscriber){
|
|
if(EventBus.getDefault().isRegistered(subscriber)){
|
|
EventBus.getDefault().unregister(subscriber);
|
|
}
|
|
}
|
|
|
|
public static void postMsg(MessageEvent meshMsgEvent){
|
|
EventBus.getDefault().post(meshMsgEvent);
|
|
}
|
|
|
|
public static void postSticky(MessageEvent meshMsgEvent){
|
|
EventBus.getDefault().postSticky(meshMsgEvent);
|
|
}
|
|
|
|
public static void removeStickEvent(MessageEvent meshMsgEvent){
|
|
EventBus.getDefault().removeStickyEvent(meshMsgEvent);
|
|
}
|
|
}
|