Search in sources :

Example 71 with Subscribe

use of org.greenrobot.eventbus.Subscribe in project AntennaPod by AntennaPod.

the class QueueFragment method onEventMainThread.

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with DownloadEvent");
    DownloaderUpdate update = event.update;
    if (event.hasChangedFeedUpdateStatus(isUpdatingFeeds)) {
        refreshToolbarState();
    }
    if (recyclerAdapter != null && update.mediaIds.length > 0) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(queue, mediaId);
            if (pos >= 0) {
                recyclerAdapter.notifyItemChangedCompat(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 72 with Subscribe

use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.

the class TimelineBroadcastListResource method onBroadcastUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onBroadcastUpdated(BroadcastUpdatedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Broadcast> broadcastList = get();
    for (int i = 0, size = broadcastList.size(); i < size; ++i) {
        Broadcast updatedBroadcast = event.update(broadcastList.get(i), this);
        if (updatedBroadcast != null) {
            broadcastList.set(i, updatedBroadcast);
            getListener().onBroadcastChanged(getRequestCode(), i, updatedBroadcast);
        }
    }
}
Also used : Broadcast(me.zhanghai.android.douya.network.api.info.frodo.Broadcast) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 73 with Subscribe

use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.

the class BroadcastActivityDialogFragment method onBroadcastUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onBroadcastUpdated(BroadcastUpdatedEvent event) {
    if (event.isFromMyself(this)) {
        return;
    }
    Broadcast updatedBroadcast = event.update(mBroadcast, this);
    if (updatedBroadcast != null) {
        mBroadcast = updatedBroadcast;
        updateTabTitle();
    }
}
Also used : Broadcast(me.zhanghai.android.douya.network.api.info.frodo.Broadcast) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 74 with Subscribe

use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.

the class BroadcastResource method onBroadcastUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onBroadcastUpdated(BroadcastUpdatedEvent event) {
    if (event.isFromMyself(this)) {
        return;
    }
    // noinspection deprecation
    Broadcast updatedBroadcast = event.update(mBroadcastId, get(), this);
    if (updatedBroadcast != null) {
        set(updatedBroadcast);
        getListener().onBroadcastChanged(getRequestCode(), updatedBroadcast);
    }
}
Also used : Broadcast(me.zhanghai.android.douya.network.api.info.frodo.Broadcast) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 75 with Subscribe

use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.

the class BroadcastRebroadcastListResource method onBroadcastDeleted.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onBroadcastDeleted(BroadcastDeletedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<RebroadcastItem> rebroadcastList = get();
    for (int i = 0, size = rebroadcastList.size(); i < size; ) {
        RebroadcastItem rebroadcastItem = rebroadcastList.get(i);
        if (rebroadcastItem.getBroadcastId() == event.broadcastId) {
            rebroadcastList.remove(i);
            getListener().onRebroadcastItemRemoved(getRequestCode(), i);
            --size;
        }
    }
}
Also used : RebroadcastItem(me.zhanghai.android.douya.network.api.info.frodo.RebroadcastItem) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Subscribe (org.greenrobot.eventbus.Subscribe)164 Intent (android.content.Intent)20 Bundle (android.os.Bundle)11 EventBus (org.greenrobot.eventbus.EventBus)10 ThreadMode (org.greenrobot.eventbus.ThreadMode)10 View (android.view.View)9 Poi (io.jawg.osmcontributor.model.entities.Poi)9 PoiType (io.jawg.osmcontributor.model.entities.PoiType)9 ArrayList (java.util.ArrayList)9 Context (android.content.Context)8 Handler (android.os.Handler)8 ViewGroup (android.view.ViewGroup)8 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)8 SuppressLint (android.annotation.SuppressLint)6 LayoutInflater (android.view.LayoutInflater)6 MenuItem (android.view.MenuItem)6 DownloaderUpdate (de.danoeh.antennapod.core.event.DownloaderUpdate)6 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)6 Disposable (io.reactivex.disposables.Disposable)6 Schedulers (io.reactivex.schedulers.Schedulers)6