當前位置: 首頁>>代碼示例>>Java>>正文


Java ThreadMode類代碼示例

本文整理匯總了Java中org.greenrobot.eventbus.ThreadMode的典型用法代碼示例。如果您正苦於以下問題:Java ThreadMode類的具體用法?Java ThreadMode怎麽用?Java ThreadMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ThreadMode類屬於org.greenrobot.eventbus包,在下文中一共展示了ThreadMode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMessageEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
/**
 * Used by EventBus
 * Called when a Publisher send a action to be executed.
 * @param actionEvent
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(final ActionEvent actionEvent) {
    switch (actionEvent.getActionRequested()) {
        case START_FAST_PROTECTION_ANALYZER:
        case STOP_FAST_PROTECTION_ANALYZER:
        case START_SEARCH_THRESHOLD:
        case STOP_SEARCH_THRESHOLD:
        case START_PROTECTION:
        case STOP_PROTECTION: {
            TaskPollManager.getInstance().put(actionEvent);
            break;
        }
        case START_JAMMING: {
            toastShow("Attack detected");

            Logger.d(TAG, "Attack detected");
            TaskPollManager.getInstance().put(actionEvent);
            break;
        }
    }
}
 
開發者ID:GRnice,項目名稱:PandwarfDefenderProject,代碼行數:27,代碼來源:Main2Activity.java

示例2: onObdJob

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onObdJob(ObdJobEvent obdJobEvent) {

    String name = obdJobEvent.getObdCommandJob().getObdCommand().getName();
    String result = obdJobEvent.getObdCommandJob().getObdCommand().getResult();

    if (result == null) {

    } else if (result.equals("NODATA")) {
        log.debug(name + ": " + obdJobEvent.getObdCommandJob().getObdCommand().getResult());
    } else {
        String formattedResult = obdJobEvent.getObdCommandJob().getObdCommand().getFormattedResult();
        log.info(name + ": " + formattedResult);
        obdData.put(name, formattedResult + "  :::  " + new Date().getTime());
        getView().showObdData(obdData);
    }
}
 
開發者ID:kocur,項目名稱:Obd2-Tracker,代碼行數:18,代碼來源:MainPresenter.java

示例3: onMessageEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(GetViewStackEvent event) {
    if (event.getStatus() != 1) return;
    try {
        JSONObject result = new JSONObject(event.getResponse() + "");
        int length = result.getJSONObject("result").getJSONArray("viewstack").length();
        if (result.getJSONObject("result").getJSONArray("viewstack").getString(length - 1).equals("movie-detail")) {
            startActivity(new Intent(Home.this, MovieDetailsActivity.class));
        } else if (result.getJSONObject("result").getJSONArray("viewstack").getString(length - 1).equals("shows-container-contain")) {
            startActivity(new Intent(Home.this, ShowDetails.class));
        } else if (result.getJSONObject("result").getJSONArray("viewstack").getString(length - 1).equals("about")) {

        } else if (result.getJSONObject("result").getJSONArray("viewstack").getString(length - 1).equals("settings-container-contain")) {

        }


    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
開發者ID:anikraj1994,項目名稱:Remote,代碼行數:22,代碼來源:Home.java

示例4: downloadMessage

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN)
public void downloadMessage(final DownloadMessage msg) {
    if (isVisible(mLlBookReadBottom)) { // 如果工具欄顯示,則進度條也顯示
        if (bookId.equals(msg.bookId)) {
            visible(mTvDownloadProgress);
            mTvDownloadProgress.setText(msg.message);
            if (msg.isComplete) {
                mTvDownloadProgress.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        gone(mTvDownloadProgress);
                    }
                }, 2500);
            }
        }
    }
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:18,代碼來源:ReadActivity.java

示例5: onEventMainThread

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(final WebRtcViewModel event) {
  Log.w(TAG, "Got message from service: " + event);

  switch (event.getState()) {
    case CALL_CONNECTED:          handleCallConnected(event);            break;
    case NETWORK_FAILURE:         handleServerFailure(event);            break;
    case CALL_RINGING:            handleCallRinging(event);              break;
    case CALL_DISCONNECTED:       handleTerminate(event.getRecipient()); break;
    case NO_SUCH_USER:            handleNoSuchUser(event);               break;
    case RECIPIENT_UNAVAILABLE:   handleRecipientUnavailable(event);     break;
    case CALL_INCOMING:           handleIncomingCall(event);             break;
    case CALL_OUTGOING:           handleOutgoingCall(event);             break;
    case CALL_BUSY:               handleCallBusy(event);                 break;
    case UNTRUSTED_IDENTITY:      handleUntrustedIdentity(event);        break;
  }

  callScreen.setLocalVideoEnabled(event.isLocalVideoEnabled());
  callScreen.setRemoteVideoEnabled(event.isRemoteVideoEnabled());
  callScreen.updateAudioState(event.isBluetoothAvailable(), event.isMicrophoneEnabled());
  callScreen.setControlsEnabled(event.getState() != WebRtcViewModel.State.CALL_INCOMING);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:23,代碼來源:WebRtcCallActivity.java

示例6: updateVoiceState

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
/**
 * new end 刷新錄音話筒圖標狀態
 **/
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateVoiceState(RecordUpdateEvent e) {
    switch (e.getState()) {
        case RecordUpdateEvent.RECORD_IDLE:
        case RecordUpdateEvent.RECORD_IDLE_AFTER_RECOGNIZED:
            voiceButton.setRecordIdleState();
            break;
        case RecordUpdateEvent.RECORDING:
            voiceButton.setRecordStartState();
            break;
        case RecordUpdateEvent.RECOGNIZING:
            voiceButton.setRecognizeCompletedState();
            break;
    }
    //        voiceButton.setHeadSetMode(((MainActivity) context).isHeadset);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:20,代碼來源:BaseEditDialog.java

示例7: handleEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.ASYNC)
public void handleEvent(RtspClientStreamEvent.MediaDataReceived event) {
    Log.d(TAG, "handleEvent: RtspClientStreamEvent.MediaDataReceived");

    try {
        switch (rtpProtocol) {
            case UDP:
                sendRtp(event.data);
                break;
            case TCP:
                Rtsp r = new RtspInterleavedData(interleavedRtpChannels.first, event.data);
                rtspSession.sendRtsp(r);
                break;
        }
    } catch (IOException e) {
        // TODO: handle exception
        e.printStackTrace();
    }
}
 
開發者ID:devinbrown7,項目名稱:streaminglib,代碼行數:20,代碼來源:RtpServerStream.java

示例8: onRecordUpdateEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
/**
 * 話筒狀態更新處理
 **/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRecordUpdateEvent(RecordUpdateEvent e) {
    switch (e.getState()) {
        case RecordUpdateEvent.RECORD_IDLE:
        case RecordUpdateEvent.RECORD_IDLE_AFTER_RECOGNIZED:
            mAnslVoiceBt.setRecordIdleState();
            break;
        case RecordUpdateEvent.RECORDING:
            mAnslVoiceBt.setRecordStartState();
            break;
        case RecordUpdateEvent.RECOGNIZING:
            mAnslVoiceBt.setRecognizeCompletedState();
            break;
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:19,代碼來源:NaviSetLineActivity.java

示例9: onNetWorkEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
/**
 * 導航相關指令處理
 **/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onNetWorkEvent(NetWorkEvent event) {
    if(event.getType()==0){
        closeLoading();
       //  showSnackBar("網絡狀態不佳,請檢查網絡設置");
       // Toast.makeText(NaviSetLineActivity.this,"網絡狀態不佳,請檢查網絡設置",Toast.LENGTH_LONG).show();
        final CommonDialog commonDialog =  new CommonDialog(this,"網絡錯誤","網絡狀態不佳,請檢查網絡設置","確定");
        commonDialog.setOnConfirmListener(new CommonDialog.OnConfirmListener() {
            @Override
            public void onConfirm() {
                commonDialog.cancel();
            }
        }).show();
        return;

    }

}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:22,代碼來源:NaviSetLineActivity.java

示例10: onEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onEvent(SyncEvent event) {
    switch (event.getCode()) {
        case SyncEvent.START_SYNC:
            showLoading();
            break;
        case SyncEvent.END_SYNC:
            hideLoading();
            EventBus.getDefault().post(new SyncEvent(SyncEvent.UPDATE_SYNC, ""));
            EventBus.getDefault().removeStickyEvent(event);
            break;
    }
    if(!event.getStatus().isEmpty()){
        Toast.makeText(this, event.getStatus(), Toast.LENGTH_SHORT).show();
    }
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:17,代碼來源:MainActivity.java

示例11: onMessageEvent

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN)
@SuppressWarnings("unused")
public void onMessageEvent(ChainsResultEvent event) {
    if (event.isGame(game)) {
        this.chainsData = event.getResult();
        notifyDataSetChanged();
    }
}
 
開發者ID:tran-khoa,項目名稱:ANNO1404-Warenrechner-App,代碼行數:9,代碼來源:ChainsAdapter.java

示例12: onEventScoreLoaded

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventScoreLoaded(List<Score> scores) {
    dataSet.clear();
    for (Score score : scores) {
        Log.e(TAG," ascore has been found for table "+score.getMultiplicationTable());
        dataSet.add(score);
    }
    arrayAdapter.notifyDataSetChanged();
}
 
開發者ID:MathiasSeguy-Android2EE,項目名稱:MultiplicationBasile,代碼行數:10,代碼來源:RecordsActivity.java

示例13: onEventPublished

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
/**
 * Responds to published events
 *
 * @param param
 */
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventPublished(Series param) {
    if(!isRemoving() && model == null) {
        model = param;
        updateUI();
    }
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:13,代碼來源:AnimeOverviewFragment.java

示例14: refreshData

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void refreshData(EventRefresh refreshEvent) {
    EventBus.getDefault().removeStickyEvent(refreshEvent);
    videoFragment.refreshData();
    photoFragment.refreshData();
    searchFragment.refreshData();
    userFragment.refreshData();
    viewPager.setCurrentItem(0);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:10,代碼來源:MainActivity.java

示例15: initCategoryList

import org.greenrobot.eventbus.ThreadMode; //導入依賴的package包/類
@Subscribe(threadMode = ThreadMode.MAIN)
public void initCategoryList(SelectionEvent event) {
    if (getUserVisibleHint()) {
        mRecyclerView.setRefreshing(true);
        sort = event.sort;
        onRefresh();
    }
}
 
開發者ID:ynztlxdeai,項目名稱:TextReader,代碼行數:9,代碼來源:BookDetailDiscussionFragment.java


注:本文中的org.greenrobot.eventbus.ThreadMode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。