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);
}
}
}
}
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;
}
}
}
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));
}
}
}
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));
}
}
}
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));
}
}
}
Aggregations