Java Code Examples for org.greenrobot.eventbus.EventBus#isRegistered()

The following examples show how to use org.greenrobot.eventbus.EventBus#isRegistered() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventBusUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 注册 EventBus
 * @param subscriber 订阅者
 */
public static void register(final Object subscriber) {
    EventBus eventBus = EventBus.getDefault();
    if (!eventBus.isRegistered(subscriber)) {
        eventBus.register(subscriber);
    }
}
 
Example 2
Source File: EventBusUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 解绑 EventBus
 * @param subscriber 订阅者
 */
public static void unregister(final Object subscriber) {
    EventBus eventBus = EventBus.getDefault();
    if (eventBus.isRegistered(subscriber)) {
        eventBus.unregister(subscriber);
    }
}
 
Example 3
Source File: ModelDetailActivity.java    From Synapse with Apache License 2.0 5 votes vote down vote up
private void registerEventBus() {
    final EventBus bus = Global.getInstance().getBus();

    if (mIntentType == IS_TRAINING
            && !bus.isRegistered(this)) {
        bus.register(this);
    }
}
 
Example 4
Source File: ModelDetailActivity.java    From Synapse with Apache License 2.0 5 votes vote down vote up
private void unregisterEvenBus() {
    final EventBus bus = Global.getInstance()
            .getBus();

    if (bus.isRegistered(this)) {
        bus.unregister(this);
    }
}
 
Example 5
Source File: HotCodePushPlugin.java    From cordova-hot-code-push with MIT License 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();

    final EventBus eventBus = EventBus.getDefault();
    if (!eventBus.isRegistered(this)) {
        eventBus.register(this);
    }

    // ensure that www folder installed on external storage;
    // if not - install it
    isPluginReadyForWork = isPluginReadyForWork();
    if (!isPluginReadyForWork) {
        dontReloadOnStart = true;
        installWwwFolder();
        return;
    }

    // reload only if we on local storage
    if (!dontReloadOnStart) {
        dontReloadOnStart = true;
        redirectToLocalStorageIndexPage();
    }

    // install update if there is anything to install
    if (chcpXmlConfig.isAutoInstallIsAllowed() &&
            !UpdatesInstaller.isInstalling() &&
            !UpdatesLoader.isExecuting() &&
            !TextUtils.isEmpty(pluginInternalPrefs.getReadyForInstallationReleaseVersionName())) {
        installUpdate(null);
    }
}