本文整理汇总了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;
}
}
示例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));
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
示例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));
}
示例8: onEventMainThread
import com.github.obsessive.library.eventbus.EventCenter; //导入依赖的package包/类
public void onEventMainThread(EventCenter eventCenter) {
if (null != eventCenter) {
onEventComming(eventCenter);
}
}
示例9: onEventComming
import com.github.obsessive.library.eventbus.EventCenter; //导入依赖的package包/类
@Override
protected void onEventComming(EventCenter eventCenter) {
}
示例10: onEventComming
import com.github.obsessive.library.eventbus.EventCenter; //导入依赖的package包/类
/**
* when event comming
*
* @param eventCenter
*/
protected abstract void onEventComming(EventCenter eventCenter);