当前位置: 首页>>代码示例>>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;未经允许,请勿转载。