Java Code Examples for org.greenrobot.eventbus.ThreadMode#MAIN

The following examples show how to use org.greenrobot.eventbus.ThreadMode#MAIN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainPresenterImpl.java    From mirror with Apache License 2.0 6 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
@SuppressWarnings("unused")
public void onEvent(CommandEvent event) {
    switch (event.getType()) {
        case CommandEvent.TYPE_COMMAND_START:
            mView.stopKeywordSpotting();
            mView.displaySearchPanel();
            break;
        case CommandEvent.TYPE_COMMAND_VOLUME:
            mView.searchPanelVolume(Integer.valueOf(event.getMessage()));
            break;
        case CommandEvent.TYPE_COMMAND_SEARCHING:
            mView.displaySearchPanelSearching();
            break;
        case CommandEvent.TYPE_COMMAND_STOP:
            mView.hideSearchPanel();
            break;
    }
}
 
Example 2
Source File: FragmentSingleIllust.java    From Pixiv-Shaft with MIT License 6 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(Channel event) {
    if (event.getReceiver().contains("FragmentSingleIllust starIllust")) {
        if (illust.getId() == (int) event.getObject()) {
            illust.setIs_bookmarked(true);
            ((FloatingActionButton) parentView.findViewById(R.id.post_like))
                    .setImageResource(R.drawable.ic_favorite_accent_24dp);
        }
    }

    if (event.getReceiver().equals("FragmentSingleIllust download finish")) {
        if ((int) event.getObject() == illust.getId()) {
            baseBind.download.setImageResource(R.drawable.ic_has_download);
        }
    }
}
 
Example 3
Source File: DownloadingFragment.java    From Yuan-SxMusic with Apache License 2.0 6 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDownloadingMessage(DownloadEvent event) {
    int status = event.getDownloadStatus();
    if (status == Constant.TYPE_DOWNLOADING || status == Constant.TYPE_DOWNLOAD_PAUSED) {//进度条更新
        DownloadInfo downloadInfo = event.getDownloadInfo();
        mDownloadInfoList.remove(downloadInfo.getPosition());
        mDownloadInfoList.add(downloadInfo.getPosition(),downloadInfo);
        mAdapter.notifyItemChanged(downloadInfo.getPosition());
    }else if(status == Constant.TYPE_DOWNLOAD_SUCCESS){//歌曲下载成功
        resetDownloadInfoList();
        mAdapter.notifyDataSetChanged();
    }else if(status == Constant.TYPE_DOWNLOAD_CANCELED){//下载取消
        resetDownloadInfoList();
        mAdapter.notifyDataSetChanged();
    }else if(status == Constant.TYPE_DOWNLOAD_ADD){//添加了正在下载歌曲
        resetDownloadInfoList();
    }
}
 
Example 4
Source File: SubCategoryFragment.java    From fangzhuishushenqi with Apache License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void initCategoryList(SubEvent event) {
    minor = event.minor;
    String type = event.type;
    if (this.type.equals(type)) {
        onRefresh();
    }
}
 
Example 5
Source File: RuleListFragment.java    From SmsCode with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRuleSaveOrUpdate(Event.OnRuleCreateOrUpdate event) {
    if (event.type == RuleEditFragment.EDIT_TYPE_CREATE) {
        mRuleAdapter.addRule(event.codeRule);
    } else if (event.type == RuleEditFragment.EDIT_TYPE_UPDATE) {
        mRuleAdapter.updateAt(mSelectedPosition, event.codeRule);
    }
}
 
Example 6
Source File: MzituPictureActivity.java    From FakeWeather with Apache License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void girlIsComing(GirlsComingEvent event) {
    if (!event.getFrom().equals(baseUrl))
        return;
    showRefreshing(false);
    if (adapter.getData() == null || adapter.getData().size() == 0) {
        adapter.setNewData(event.getGirls());
    } else {
        adapter.addData(adapter.getData().size(), event.getGirls());
    }
}
 
Example 7
Source File: StarActivity.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void refreshUI(EventMessage eventBusMessage) {
    if (Objects.equals(eventBusMessage.getType(), EventMessage.COLLECTION_FOLDER_OPERATION)){//收藏状态修改
        //重新构造tablayout
        createTabLayout();
    }
}
 
Example 8
Source File: RoomUpdateActivity.java    From VideoMeeting with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onParnerAdd(AddParticipatorEvent event) {
    L.d("onParnerAdd "+event.participator.toString());
    room.getParticipator().addAll(event.participator);
    updateParnerUI(room);
}
 
Example 9
Source File: MainPresenterImpl.java    From mirror with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
@SuppressWarnings("unused")
public void onEvent(ResetEvent event) {
    removeView(event.getPresenterClass());
}
 
Example 10
Source File: DaoOperationFragment.java    From GreenDaoSample with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void userChange(UserChangeEvent userChangeEvent) {
    loadAllDataByLocal();
}
 
Example 11
Source File: MainActivity.java    From android-open-framework-analysis with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(Event event) {
    Toast.makeText(this, event.getMessage(), Toast.LENGTH_SHORT).show();
}
 
Example 12
Source File: SelectedAppsView.java    From FastAccess with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN) public void onEvent(SelectedAppsEventModel eventModel) {
    onNotifyChanges();
}
 
Example 13
Source File: FriendInfoActivity.java    From Android with MIT License 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(MsgNoticeBean notice) {
    presenter.checkOnEvent(notice);
}
 
Example 14
Source File: WebViewActivity.java    From movienow with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 检测到视频
 *
 * @param videoEvent 视频
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void onFindVideoEvent(FindVideoEvent videoEvent) {
    if (tSnackbar != null) {
        try {
            tSnackbar.dismiss();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    if (bottomBar.getVisibility() == GONE) {
        bottomBar.setVisibility(VISIBLE);
        bottomBar.animate().alpha(1).setDuration(300).start();
    }
    bottomBarXiuTan.setCornerText(videoEvent.getTitle());
    if (isXiuTanAutoPlayMode) {
        String dom = StringUtil.getDom(webViewT.getUrl());
        String url = StringUtil.getDom(videoEvent.getUrl());
        if (DetectorManager.getInstance().inXiuTanLiked(getContext(), dom, url)) {
            int code = getIntent().getIntExtra("uWho", 0);
            if (TextUtils.isEmpty(movieTitle)) movieTitle = webViewT.getTitle();
            if (code == 0 && !isOnPause && !hasAutoPlay) {
                hasAutoPlay = true;
                ToastMgr.toastShortBottomCenter(getContext(), "已自动播放常用的嗅探地址");
                PlayChooser.startPlayer(getContext(), movieTitle, videoEvent.getUrl());
            } else if (code == 304 && !isOnPause && !hasAutoPlay) {
                hasAutoPlay = true;
                ToastMgr.toastShortBottomCenter(getContext(), "已自动播放常用的嗅探地址");
                Intent intent = new Intent();
                intent.putExtra("videourl", videoEvent.getUrl());
                intent.putExtra("title", movieTitle);
                setResult(code, intent);
                finish();
            }
        }
    }
    if (!hasDismissXiuTan) {
        hasDismissXiuTan = true;
        if (!hasAutoPlay) {
            new PromptDialog(this)
                    .setDialogType(PromptDialog.DIALOG_TYPE_SUCCESS)
                    .setAnimationEnable(true)
                    .setTitleText("方圆嗅探")
                    .setContentText("网页中检测到" + videoEvent.getTitle() + "条视频链接,点击查看按钮查看或者播放视频链接")
                    .setPositiveListener("查看视频", new PromptDialog.OnPositiveListener() {
                        @Override
                        public void onClick(PromptDialog dialog) {
                            dialog.dismiss();
                            showVideoList();
                        }
                    }).show();
        }
    }
}
 
Example 15
Source File: MenuListActivity.java    From financisto with GNU General Public License v2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDriveRestoreSuccess(DriveRestoreSuccess event) {
    dismissProgressDialog();
    Toast.makeText(this, R.string.restore_database_success, Toast.LENGTH_LONG).show();
}
 
Example 16
Source File: PersonInfoFragment.java    From tysq-android with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateUserInfo(UserInfoUpdateEvent userInfoUpdate) {
    setHeadPhoto();
}
 
Example 17
Source File: MainWearActivity.java    From BusWear with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(Float floatReceived) {
    Toast.makeText(MainWearActivity.this, "Received Float", Toast.LENGTH_SHORT).show();
}
 
Example 18
Source File: MainActivity.java    From smart-farmer-android with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLoginEvent(EventModel.LoginEvent event) {
    //接收到登陆成功事件之后,初始化 融云 极光等

}
 
Example 19
Source File: EventBusTest.java    From RxBus with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN, priority = 1, sticky = true)
public void onMessageEvent1(String event) {
    System.out.println(event + "1");
}
 
Example 20
Source File: AutoScheduleActivity.java    From BetterWay with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDeadMessgeEvent(DeadMessage message) {
    if (message == DeadMessage.FINISH) {
        finish();
    }
}