Search in sources :

Example 1 with PhotoViewEvent

use of pri.weiqaing.common.rxbus.event.PhotoViewEvent in project MyJapanese by 54wall.

the class MainActivityPresenterImpl method onBusEventInteraction.

@Override
public void onBusEventInteraction(EventContainer eventContainer) {
    Log.i(TAG, "onBusEventInteraction: " + eventContainer);
    switch(eventContainer.getType()) {
        case EventContainer.TYPE_PHOTOVIEW:
            PhotoViewEvent photoViewEvent = (PhotoViewEvent) eventContainer.getEvent();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.IMG_URL, photoViewEvent.getImg_url());
            bundle.putInt(Constants.IMG_ID, photoViewEvent.getImg_id());
            view.startPhotoViewActivity(bundle);
            break;
        case EventContainer.TYPE_GAME:
            GameEvent gameEvent = (GameEvent) eventContainer.getEvent();
            switch(gameEvent.getType()) {
                case GameEvent.TYPE_PUZZLE:
                    view.startPuzzleActivity();
                    break;
                case GameEvent.TYPE_SUPPERZZLE:
                    view.startSupperzzleActivity();
                    break;
                default:
                    break;
            }
            break;
        case EventContainer.TYPE_SETTING:
            SettingEvent event = (SettingEvent) eventContainer.getEvent();
            view.showSnackBar(event.getMsg());
            break;
        default:
            break;
    }
}
Also used : Bundle(android.os.Bundle) SettingEvent(pri.weiqaing.common.rxbus.event.SettingEvent) PhotoViewEvent(pri.weiqaing.common.rxbus.event.PhotoViewEvent) GameEvent(pri.weiqaing.common.rxbus.event.GameEvent)

Example 2 with PhotoViewEvent

use of pri.weiqaing.common.rxbus.event.PhotoViewEvent in project MyJapanese by 54wall.

the class PixivIllustFragment method showImg.

@Override
public void showImg(String url, int id) {
    PhotoViewEvent event = new PhotoViewEvent(url, id);
    RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_PHOTOVIEW, event));
}
Also used : EventContainer(pri.weiqaing.common.rxbus.event.EventContainer) PhotoViewEvent(pri.weiqaing.common.rxbus.event.PhotoViewEvent)

Example 3 with PhotoViewEvent

use of pri.weiqaing.common.rxbus.event.PhotoViewEvent in project LiYuJapanese by 54wall.

the class PixivIllustFragment method showImg.

@Override
public void showImg(String url, int id) {
    PhotoViewEvent event = new PhotoViewEvent(url, id);
    RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_PHOTOVIEW, event));
}
Also used : EventContainer(pri.weiqaing.common.rxbus.event.EventContainer) PhotoViewEvent(pri.weiqaing.common.rxbus.event.PhotoViewEvent)

Example 4 with PhotoViewEvent

use of pri.weiqaing.common.rxbus.event.PhotoViewEvent in project LiYuJapanese by 54wall.

the class MainActivityPresenterImpl method onBusEventInteraction.

@Override
public void onBusEventInteraction(EventContainer eventContainer) {
    Log.i(TAG, "onBusEventInteraction: " + eventContainer);
    switch(eventContainer.getType()) {
        case EventContainer.TYPE_PHOTOVIEW:
            PhotoViewEvent photoViewEvent = (PhotoViewEvent) eventContainer.getEvent();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.IMG_URL, photoViewEvent.getImg_url());
            bundle.putInt(Constants.IMG_ID, photoViewEvent.getImg_id());
            view.startPhotoViewActivity(bundle);
            break;
        case EventContainer.TYPE_GAME:
            GameEvent gameEvent = (GameEvent) eventContainer.getEvent();
            switch(gameEvent.getType()) {
                case GameEvent.TYPE_PUZZLE:
                    view.startPuzzleActivity();
                    break;
                case GameEvent.TYPE_SUPPERZZLE:
                    view.startSupperzzleActivity();
                    break;
                default:
                    break;
            }
            break;
        case EventContainer.TYPE_SETTING:
            SettingEvent event = (SettingEvent) eventContainer.getEvent();
            view.showSnackBar(event.getMsg());
            break;
        default:
            break;
    }
}
Also used : Bundle(android.os.Bundle) SettingEvent(pri.weiqaing.common.rxbus.event.SettingEvent) PhotoViewEvent(pri.weiqaing.common.rxbus.event.PhotoViewEvent) GameEvent(pri.weiqaing.common.rxbus.event.GameEvent)

Aggregations

PhotoViewEvent (pri.weiqaing.common.rxbus.event.PhotoViewEvent)4 Bundle (android.os.Bundle)2 EventContainer (pri.weiqaing.common.rxbus.event.EventContainer)2 GameEvent (pri.weiqaing.common.rxbus.event.GameEvent)2 SettingEvent (pri.weiqaing.common.rxbus.event.SettingEvent)2