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


Java EventCenter類代碼示例

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


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

示例1: onCallStateChanged

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
public void onCallStateChanged(int state, String incomingNumber) {
    super.onCallStateChanged(state, incomingNumber);
    switch (state) {
        case TelephonyManager.CALL_STATE_OFFHOOK:
        case TelephonyManager.CALL_STATE_RINGING:
            EventBus.getDefault().post(new EventCenter(Constants.EVENT_STOP_PLAY_MUSIC));

            break;

        case TelephonyManager.CALL_STATE_IDLE:
            EventBus.getDefault().post(new EventCenter(Constants.EVENT_START_PLAY_MUSIC));

            break;
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:17,代碼來源:MusicPlayService.java

示例2: onReceive

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
    if (null == intent) {
        return;
    }

    String action = intent.getAction();

    if (action.equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
        EventBus.getDefault().post(new EventCenter(Constants.EVENT_STOP_PLAY_MUSIC));
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:13,代碼來源:MusicPlayService.java

示例3: onEventComming

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
protected void onEventComming(EventCenter eventCenter) {
    if (null == mMusicsPresenter) {
        return;
    }
    int eventCode = eventCenter.getEventCode();
    switch (eventCode) {
        case Constants.EVENT_START_PLAY_MUSIC:
            mMusicsPresenter.onRePlay();
            break;
        case Constants.EVENT_STOP_PLAY_MUSIC:
            mMusicsPresenter.onPausePlay();
            break;
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:16,代碼來源:MusicsFragment.java

示例4: onReceive

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
    if (null == intent) {
        return;
    }

    String action = intent.getAction();

    if (action.equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
        EventBus.getDefault().post(new EventCenter(Constants.EVENT_STOP_PLAY_MUSIC));
    } else {
        final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        telephonyManager.listen(new PhoneStateListener() {
            @Override
            public void onCallStateChanged(int state, String incomingNumber) {
                super.onCallStateChanged(state, incomingNumber);
                switch (state) {
                    case TelephonyManager.CALL_STATE_OFFHOOK:
                    case TelephonyManager.CALL_STATE_RINGING:
                        EventBus.getDefault().post(new EventCenter(Constants.EVENT_STOP_PLAY_MUSIC));

                        break;

                    case TelephonyManager.CALL_STATE_IDLE:
                        EventBus.getDefault().post(new EventCenter(Constants.EVENT_START_PLAY_MUSIC));

                        break;
                }
            }
        }, PhoneStateListener.LISTEN_CALL_STATE);
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:33,代碼來源:PhoneCallReceiver.java

示例5: onEventMainThread

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
public void onEventMainThread(EventCenter eventCenter) {
    if (null == mVaryViewHelperController) {
        throw new IllegalArgumentException("You must return a right target view for loading");
    }

    if (null != eventCenter) {
        onEventComming(eventCenter);
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:10,代碼來源:BasePlayerActivity.java

示例6: onResume

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
protected void onResume() {
    super.onResume();
    EventBus.getDefault().post(new EventCenter(Constants.EVENT_STOP_PLAY_MUSIC));
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:6,代碼來源:PlayerActivity.java

示例7: onPause

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
protected void onPause() {
    super.onPause();
    EventBus.getDefault().post(new EventCenter(Constants.EVENT_START_PLAY_MUSIC));
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:6,代碼來源:PlayerActivity.java

示例8: onEventMainThread

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
public void onEventMainThread(EventCenter eventCenter) {
    if (null != eventCenter) {
        onEventComming(eventCenter);
    }
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:6,代碼來源:BaseAppCompatActivity.java

示例9: onEventComming

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
@Override
protected void onEventComming(EventCenter eventCenter) {

}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:5,代碼來源:VideosContainerFragment.java

示例10: onEventComming

import com.github.obsessive.library.eventbus.EventCenter; //導入依賴的package包/類
/**
 * when event comming
 *
 * @param eventCenter
 */
protected abstract void onEventComming(EventCenter eventCenter);
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:7,代碼來源:BaseAppCompatActivity.java


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