Search in sources :

Example 11 with Subscribe

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));
        }
    }
}
Also used : Diary(me.zhanghai.android.douya.network.api.info.frodo.Diary) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 12 with Subscribe

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));
        }
    }
}
Also used : Review(me.zhanghai.android.douya.network.api.info.frodo.Review) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 13 with Subscribe

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;
        }
    }
}
Also used : Notification(me.zhanghai.android.douya.network.api.info.frodo.Notification) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 14 with Subscribe

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));
        }
    }
}
Also used : Notification(me.zhanghai.android.douya.network.api.info.frodo.Notification) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 15 with Subscribe

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);
        }
    }
}
Also used : AbstractAppLock(org.wordpress.passcodelock.AbstractAppLock) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Subscribe (org.greenrobot.eventbus.Subscribe)43 Intent (android.content.Intent)7 SiteModel (org.wordpress.android.fluxc.model.SiteModel)5 NotificationManager (android.app.NotificationManager)3 NotificationCompat (android.support.v4.app.NotificationCompat)3 Activity (android.app.Activity)2 PendingIntent (android.app.PendingIntent)2 Context (android.content.Context)2 Cursor (android.database.Cursor)2 AspectPermission (com.yydcdut.note.aspect.permission.AspectPermission)2 CategoryCreateEvent (com.yydcdut.note.bus.CategoryCreateEvent)2 CategoryDeleteEvent (com.yydcdut.note.bus.CategoryDeleteEvent)2 CategoryEditEvent (com.yydcdut.note.bus.CategoryEditEvent)2 CategoryMoveEvent (com.yydcdut.note.bus.CategoryMoveEvent)2 CategoryUpdateEvent (com.yydcdut.note.bus.CategoryUpdateEvent)2 PhotoNoteCreateEvent (com.yydcdut.note.bus.PhotoNoteCreateEvent)2 PhotoNoteDeleteEvent (com.yydcdut.note.bus.PhotoNoteDeleteEvent)2 UserImageEvent (com.yydcdut.note.bus.UserImageEvent)2 Category (com.yydcdut.note.entity.Category)2 ContextLife (com.yydcdut.note.injector.ContextLife)2