全志代码首次提交
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user