use of pri.weiqiang.myjapanese.rxbus.event.GameEvent in project MyJapanese by 54wall.
the class GameFragment method initVariable.
@Override
protected void initVariable(@Nullable Bundle savedInstanceState) {
mPuzzleCardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_GAME, new GameEvent(GameEvent.TYPE_PUZZLE)));
}
});
mSupperzzleCardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RxBus.getDefault().post(new EventContainer(EventContainer.TYPE_GAME, new GameEvent(GameEvent.TYPE_SUPPERZZLE)));
}
});
}
use of pri.weiqiang.myjapanese.rxbus.event.GameEvent 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;
}
}
Aggregations