use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.
the class UserDiaryListResource method onDiaryUpdated.
@Subscribe(threadMode = ThreadMode.MAIN)
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));
}
}
}
use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.
the class BaseReviewListResource method onReviewUpdated.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onReviewUpdated(ReviewUpdatedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<Review> reviewList = get();
for (int i = 0, size = reviewList.size(); i < size; ++i) {
Review review = reviewList.get(i);
if (review.id == event.review.id) {
reviewList.set(i, event.review);
getListener().onReviewChanged(getRequestCode(), i, reviewList.get(i));
}
}
}
use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.
the class NotificationListResource method onNotificationDeleted.
@Subscribe(threadMode = ThreadMode.MAIN)
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.MAIN)
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 WordPress-Android by wordpress-mobile.
the class WordPress method onAccountChanged.
@SuppressWarnings("unused")
@Subscribe(threadMode = ThreadMode.MAIN)
public void onAccountChanged(OnAccountChanged event) {
if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) {
flushHttpCache();
// Analytics resets
AnalyticsTracker.endSession(false);
AnalyticsTracker.clearAllData();
// disable passcode lock
AbstractAppLock appLock = AppLockManager.getInstance().getAppLock();
if (appLock != null) {
appLock.setPassword(null);
}
}
}
Aggregations