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

The following examples show how to use org.greenrobot.eventbus.EventBus#post() . 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: Stream.java    From PrivacyStreams with Apache License 2.0 6 votes vote down vote up
private synchronized void syncItems() {
    int numReceived = this.streamItems.size();

    for (int i = 0; i < this.receivers.size(); i++) {
        int numSent = this.numSents.get(i);
        if (numSent < numReceived) {
            this.numSents.set(i, numReceived);
            EventBus eventBus = this.eventBuses.get(i);
            int currentReceiverCount = this.receiverCount;
            for (int itemId = numSent; itemId < numReceived; itemId++) {
                eventBus.post(streamItems.get(itemId));
                if (currentReceiverCount != this.receiverCount) break;
            }
        }
    }
}
 
Example 2
Source File: ExchangeRateUpdateTaskHandler.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPostExecute(String result) {
    EventBus bus = EventBus.getDefault();

    if (networkError) {
        NetworkError error = new NetworkError();
        error.setErrorType(NetworkErrorType.EXCHANGE_RATE_ERROR);
        bus.post(error);
    } else
        bus.post(new ExchangeRateUpdateCompleted());
}
 
Example 3
Source File: AsyncFunction.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
public final Tout apply(UQI uqi, Tin input) {
    this.uqi = uqi;
    this.input = input;
    this.output = this.init(uqi, input);
    EventBus tempBus = new EventBus();
    tempBus.register(this);
    tempBus.post(new Object());
    return this.output;
}
 
Example 4
Source File: ExchangeRateUpdateTaskHandler.java    From android-wallet-app with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPostExecute(String result) {
    EventBus bus = EventBus.getDefault();

    if (networkError) {
        NetworkError error = new NetworkError();
        error.setErrorType(NetworkErrorType.EXCHANGE_RATE_ERROR);
        bus.post(error);
    } else
        bus.post(new ExchangeRateUpdateCompleted());
}
 
Example 5
Source File: ParticleDevice.java    From spark-sdk-android with Apache License 2.0 4 votes vote down vote up
private void sendSystemEventBroadcast(DeviceStateChange deviceStateChange, EventBus eventBus) {
    cloud.sendSystemEventBroadcast(deviceStateChange);
    eventBus.post(deviceStateChange);
}