当前位置: 首页>>代码示例>>Java>>正文


Java EventBus类代码示例

本文整理汇总了Java中org.simple.eventbus.EventBus的典型用法代码示例。如果您正苦于以下问题:Java EventBus类的具体用法?Java EventBus怎么用?Java EventBus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventBus类属于org.simple.eventbus包,在下文中一共展示了EventBus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStartCommand

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent.getBooleanExtra(PAUSE_DOWNLOAD, false)) {
        queue.pause();
        return START_REDELIVER_INTENT;
    }
    VideoDownLoadInfo video = (VideoDownLoadInfo) intent.getSerializableExtra(VIDEOS_INFO);
    EventBus.getDefault().postSticky(video,EventBusTags.CACHE_DOWNLOAD_BEGIN);
    videos.put(video.getId()+"",video);
    File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Sunny_Videos");
    if (!dir.exists()) {
        dir.mkdirs();
    }
    DaoMaster master = GreenDaoHelper.getInstance().create(video.getDbName()).getMaster();
    master.newSession().startAsyncSession().insertOrReplace(video);
    File file = new File(dir.getAbsolutePath(), video.getId() + ".mp4");
    BaseDownloadTask task = (FileDownloader.getImpl().create(video.getVideo().getPlayUrl()).setPath(file.getAbsolutePath()).setTag(video.getId()+""));
    task.setListener(new CommonDownloadListener());
    queue.enqueue(task);
    if (isInit){
        queue.resume();
        isInit = false;
    }
    return START_NOT_STICKY;
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:26,代码来源:CacheDownLoadService.java

示例2: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Nullable
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mApplication = (BaseApplication) getApplication();
    //如果intent包含了此字段,并且为true说明不加入到list
    // 默认为false,如果不需要管理(比如不需要在退出所有activity(killAll)时,退出此activity就在intent加此字段为true)
    boolean isNotAdd = false;
    if (getIntent() != null)
        isNotAdd = getIntent().getBooleanExtra(IS_NOT_ADD_ACTIVITY_LIST, false);

    if (!isNotAdd)
        mApplication.getAppManager().addActivity(this);

    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().register(this);//注册到事件主线
    setContentView(initView());
    //绑定到butterknife
    mUnbinder = ButterKnife.bind(this);
    ComponentInject();//依赖注入
    initData();
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:23,代码来源:BaseActivity.java

示例3: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    EventBus.getDefault().register(this);
    LoggerManager.i(TAG, "getRequestedOrientation:" + (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED));
    //先判断xml没有设置屏幕模式避免将开发者本身想设置的覆盖掉
    if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
        setRequestedOrientation(getOrientation());
    }
    super.onCreate(savedInstanceState);
    mContext = this;
    FastStackUtil.getInstance().push(this);
    initSwipeBack();
    beforeSetContentView();
    mContentView = View.inflate(mContext, getContentLayout(), null);
    setContentView(mContentView);
    mUnBinder = ButterKnife.bind(this);
    setNavigationBar();
    mIsViewLoaded = true;
    beforeInitView();
    initView(savedInstanceState);
}
 
开发者ID:AriesHoo,项目名称:FastLib,代码行数:22,代码来源:BasisActivity.java

示例4: onDestroy

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
protected void onDestroy() {
    super.onDestroy();
    if (mPresenter != null) mPresenter.onDestroy();//释放资源
    if (mUnbinder != Unbinder.EMPTY) mUnbinder.unbind();
    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().unregister(this);
    this.mPresenter = null;
    this.mUnbinder = null;
    this.mApplication = null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BaseActivity.java

示例5: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Nullable
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mApplication = (BaseApplication) getApplication();
    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().register(this);//注册到事件主线
    setContentView(initView());
    //绑定到butterknife
    mUnbinder = ButterKnife.bind(this);
    ComponentInject();//依赖注入
    initData();
}
 
开发者ID:Wan7451,项目名称:mvparms,代码行数:14,代码来源:BaseActivity.java

示例6: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.pay_result);
      
  	api = WXAPIFactory.createWXAPI(this, Constant.APP_ID);
      api.handleIntent(getIntent(), this);

EventBus.getDefault().register(this);
  }
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:11,代码来源:WXPayEntryActivity.java

示例7: onDestroy

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
public void onDestroy() {
    super.onDestroy();
    if (mPresenter != null) mPresenter.onDestroy();//释放资源
    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().unregister(this);
    this.mPresenter = null;
    this.mActivity = null;
    this.mRootView = null;
    this.mUnbinder = null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BaseFragment.java

示例8: SnackbarText

import org.simple.eventbus.EventBus; //导入依赖的package包/类
/**
 * 用snackbar显示
 *
 * @param text
 */
public static void SnackbarText(String text) {
    Message message = new Message();
    message.what = SHOW_SNACKBAR;
    message.obj = text;
    message.arg1 = 0;
    EventBus.getDefault().post(message, APPMANAGER_MESSAGE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:UiUtils.java

示例9: startActivity

import org.simple.eventbus.EventBus; //导入依赖的package包/类
/**
 * 跳转界面3
 *
 * @param
 * @param homeActivityClass
 */
public static void startActivity(Class homeActivityClass) {
    Message message = new Message();
    message.what = START_ACTIVITY;
    message.obj = homeActivityClass;
    EventBus.getDefault().post(message, APPMANAGER_MESSAGE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:UiUtils.java

示例10: onDestroy

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
public void onDestroy() {
    super.onDestroy();
    EventBus.getDefault().unregister(this);
    unDisposeAll();
    this.mCompositeDisposable = null;
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:8,代码来源:BaseService.java

示例11: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
    if (iActivity.useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().register(mActivity);//注册到事件主线
    iActivity.setupActivityComponent(((App) mActivity.getApplication()).getAppComponent());//依赖注入
    try {
        int layoutResID = iActivity.initView();
        if (layoutResID != 0)//如果initView返回0,框架则不会调用setContentView()
            mActivity.setContentView(layoutResID);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //绑定到butterknife
    mUnbinder = ButterKnife.bind(mActivity);
    iActivity.initData();
}
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:16,代码来源:ActivityDelegateImpl.java

示例12: onDestroy

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
public void onDestroy() {
    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().unregister(this);//解除注册eventbus
    unSubscribe();//解除订阅
    if (mModel != null) {
        mModel.onDestroy();
        this.mModel = null;
    }
    this.mRootView = null;
    this.mCompositeSubscription = null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:BasePresenter.java

示例13: onDestroy

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
protected void onDestroy() {
    super.onDestroy();
    mApplication.getAppManager().removeActivity(this);
    if (mPresenter != null) mPresenter.onDestroy();//释放资源
    if (mUnbinder != Unbinder.EMPTY) mUnbinder.unbind();
    if (useEventBus())//如果要使用eventbus请将此方法返回true
        EventBus.getDefault().unregister(this);
    this.mPresenter = null;
    this.mUnbinder = null;
    this.mApplication = null;
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:13,代码来源:BaseActivity.java

示例14: onCreate

import org.simple.eventbus.EventBus; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    photo_id = getArguments().getInt("photo_id");
    mProduct = (PhotoDetails.Product) getArguments().getSerializable("mProduct");

    EventBus.getDefault().register(this);
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:9,代码来源:PayFragment.java

示例15: release

import org.simple.eventbus.EventBus; //导入依赖的package包/类
/**
 * 释放资源
 */
public void release() {
    EventBus.getDefault().unregister(this);
    mActivityList.clear();
    mActivityList = null;
    mCurrentActivity = null;
    mApplication = null;
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:11,代码来源:AppManager.java


注:本文中的org.simple.eventbus.EventBus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。