Search in sources :

Example 86 with Subscribe

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

the class FeedItemlistFragment method onEventMainThread.

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

Example 87 with Subscribe

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

the class NotificationListResource method onNotificationDeleted.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onNotificationDeleted(NotificationDeletedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Notification> notificationList = get();
    for (int i = 0, size = notificationList.size(); i < size; ) {
        Notification notification = notificationList.get(i);
        if (notification.id == event.notificationId) {
            notificationList.remove(i);
            getListener().onNotificationRemoved(getRequestCode(), i);
            --size;
        } else {
            ++i;
        }
    }
}
Also used : Notification(me.zhanghai.android.douya.network.api.info.frodo.Notification) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 88 with Subscribe

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

the class NotificationListResource method onNotificationUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onNotificationUpdated(NotificationUpdatedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Notification> notificationList = get();
    for (int i = 0, size = notificationList.size(); i < size; ++i) {
        Notification notification = notificationList.get(i);
        if (notification.id == event.notification.id) {
            notificationList.set(i, event.notification);
            getListener().onNotificationChanged(getRequestCode(), i, notificationList.get(i));
        }
    }
}
Also used : Notification(me.zhanghai.android.douya.network.api.info.frodo.Notification) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 89 with Subscribe

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

the class BaseDoulistResource method onDoulistUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onDoulistUpdated(DoulistUpdatedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Doulist> doulistList = get();
    for (int i = 0, size = doulistList.size(); i < size; ++i) {
        Doulist doulist = doulistList.get(i);
        if (doulist.id == event.doulist.id) {
            doulistList.set(i, event.doulist);
            getListener().onDoulistChanged(getRequestCode(), i, doulistList.get(i));
        }
    }
}
Also used : Doulist(me.zhanghai.android.douya.network.api.info.frodo.Doulist) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 90 with Subscribe

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

the class UserDiaryListResource method onDiaryUpdated.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onDiaryUpdated(DiaryUpdatedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Diary> diaryList = get();
    for (int i = 0, size = diaryList.size(); i < size; ++i) {
        Diary diary = diaryList.get(i);
        if (diary.id == event.diary.id) {
            diaryList.set(i, event.diary);
            getListener().onDiaryChanged(getRequestCode(), i, diaryList.get(i));
        }
    }
}
Also used : Diary(me.zhanghai.android.douya.network.api.info.frodo.Diary) 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