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


Java Subscribe类代码示例

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


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

示例1: onEventMainThread

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EventFocusCancel focusCancel){
    if (mOverlayView != null) {
        mOverlayView.setSelected(false);
    }
    postInvalidate();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:8,代码来源:MyImageViewDrawableOverlay.java

示例2: onEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
/**
 * Listener for event that assets folder are now installed on the external storage.
 * From that moment all content will be displayed from it.
 *
 * @param event event details
 * @see AssetsInstalledEvent
 * @see AssetsHelper
 * @see EventBus
 */
@SuppressWarnings("unused")
@Subscribe
public void onEvent(final AssetsInstalledEvent event) {
    // update stored application version
    pluginInternalPrefs.setAppBuildVersion(VersionHelper.applicationVersionCode(cordova.getActivity()));
    pluginInternalPrefs.setWwwFolderInstalled(true);
    pluginInternalPrefsStorage.storeInPreference(pluginInternalPrefs);

    isPluginReadyForWork = true;

    PluginResult result = PluginResultHelper.pluginResultFromEvent(event);
    sendMessageToDefaultCallback(result);

    if (chcpXmlConfig.isAutoDownloadIsAllowed() &&
            !UpdatesInstaller.isInstalling() && !UpdatesLoader.isExecuting()) {
        fetchUpdate();
    }
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:28,代码来源:HotCodePushPlugin.java

示例3: onError

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onError(final OnStatusError onStatusError) {
  if (view != null) {
    if (onStatusError.getRequest() != BaseActivity.REQUEST_CODE_SEND) {
      return;
    }
    if (isUpdate) {
      walletLoading.onError(onStatusError);
      return;
    }
    view.hideProgressDialog();

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
      @Override
      public void run() {
        if (onStatusError.getMessage() == null) {
          view.onError(view.getContext().getString(R.string.send_error_send));
        } else {
          view.onError(onStatusError.getMessage());
        }
      }
    }, 500);

  }
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:27,代码来源:SendPresenterImpl.java

示例4: onEventMainThread

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ViewEvent event) {

    ViewEvent.EvenType type = event.getType();
    Bundle args = event.getArgs();

    if (!isInformation) {
        switch (type) {

            case sqlTabItemClick:
                if (!isInformation) {
                    mClickPosition = (int) args.get(ViewEvent.Keys.SQL_TAB_ITEM_CLICK);
                    if (!isEdit) {
                        isEdit = true;
                        mToolbar.getMenu().clear();
                        mToolbar.inflateMenu(R.menu.sql_add_column_menu);
                        mToolBarButton.setVisibility(View.GONE);
                    }
                }

                break;
        }
    }

}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:26,代码来源:SqlCreateTableActivity.java

示例5: onEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
/**
 * Listener for event that some error happened during the update installation.
 *
 * @param event event information
 * @see UpdateInstallationErrorEvent
 * @see EventBus
 * @see UpdatesInstaller
 */
@SuppressWarnings("unused")
@Subscribe
public void onEvent(UpdateInstallationErrorEvent event) {
    Log.d("CHCP", "Failed to install");

    PluginResult jsResult = PluginResultHelper.pluginResultFromEvent(event);

    // notify js
    if (installJsCallback != null) {
        installJsCallback.sendPluginResult(jsResult);
        installJsCallback = null;
    }

    sendMessageToDefaultCallback(jsResult);

    rollbackIfCorrupted(event.error());
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:26,代码来源:HotCodePushPlugin.java

示例6: onEventMainThread

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Override
@Subscribe
public void onEventMainThread(LoginEvent event) {
    switch (event.getEventType()) {
        case LoginEvent.onSignInError:
            onSignInError(event.getErrorMesage());
            break;
        case LoginEvent.onSignInSuccess:
            onSignInSuccess(event.getLoggedUserEmail());
            break;
        case LoginEvent.onSignUpError:
            onSignUpError(event.getErrorMesage());
            break;
        case LoginEvent.onSignUpSuccess:
            onSignUpSuccess();
            break;
        case LoginEvent.onFailedToRecoverSession:
            onFailedToRecoverSession();
            break;
    }
}
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:22,代码来源:LoginPresenterImpl.java

示例7: onStatusRefresh

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe
public void onStatusRefresh(StatusRefreshEvent statusRefreshEvent) {
    int position = -1;
    StatusRes statusRes = statusRefreshEvent.getStatusRes();
    List<StatusRes> statusResList = mStatusAdapter.getAllData();

    for (int i = 0; i < statusResList.size(); i++) {
        if (statusResList.get(i).getId().equals(statusRes.getId())) {
            position = i;
            break;
        }
    }
    if (position < 0) {
        return;
    }
    if (statusRefreshEvent.getType().equals(StatusRefreshEvent.TYPE_DELETE_STATUS)) {
        mStatusAdapter.remove(position);
    } else if (statusRefreshEvent.getType().equals(StatusRefreshEvent.TYPE_FAVORITE_STATUS)) {
        mStatusAdapter.update(statusRes, position);
    }
}
 
开发者ID:betroy,项目名称:xifan,代码行数:22,代码来源:HomeFragment.java

示例8: onEventMainThread

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Override
@Subscribe
public void onEventMainThread(RecipeListEvent event) {
    if (this.view != null) {
        switch (event.getType()) {
            case RecipeListEvent.READ_EVENT:
                view.setRecipes(event.getRecipeList());
                break;
            case RecipeListEvent.UPDATE_EVENT:
                view.recipeUpdated();
                break;
            case RecipeListEvent.DELETE_EVENT:
                Recipe recipe = event.getRecipeList().get(0);
                view.recipeDeleted(recipe);
                break;
        }
    }

}
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:20,代码来源:RecipeListPresenterImpl.java

示例9: onMergedEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMergedEvent(EventMergeFinish mergeService) {
    ProgressBarHelper.getInstance(true).dismiss();
    try {
        mViewDrawableOverlay.setVisibility(View.GONE);
        ViewAnimator.animate(mGifImageView).fadeIn().accelerate().duration(600).start();
        mGifImageView.setVisibility(View.VISIBLE);
        GifDrawable gifFromBytes = new GifDrawable(mergeService.getGifPath());
        gifFromBytes.setLoopCount(0xFFFF);
        mGifImageView.setImageDrawable(gifFromBytes);
        mStickerTextDownLoadDialog.dismiss();
    } catch (IOException e) {
        e.printStackTrace();
    }
    String mergePath = mergeService.getGifPath();
    EventBus.getDefault().post(new EventStartNewThread(true, mergePath));
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:18,代码来源:VoiceMainActivity.java

示例10: onQuerySummit

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe
public void onQuerySummit(QueryEvent event) {
    if (!isShown()) {
        return;
    }
    if (event == QueryEvent.CLEAR) {
        mWebView.clearMatches();
        mPreviousQuery = null;
        return;
    }
    if (event.isFindForward()) {
        mWebView.findNext(false);
        return;
    }
    if (event.getQuery().equals(mPreviousQuery)) {
        mWebView.findNext(true);
        return;
    }
    mWebView.findAllAsync(event.getQuery());
    mPreviousQuery = event.getQuery();
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:22,代码来源:DocsFragment.java

示例11: onEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
/**
 * Listener for event that there is no update available at the moment.
 * We are as fresh as possible.
 *
 * @param event event information
 * @see EventBus
 * @see NothingToUpdateEvent
 * @see UpdatesLoader
 */
@SuppressWarnings("unused")
@Subscribe
public void onEvent(NothingToUpdateEvent event) {
    Log.d("CHCP", "Nothing to update");

    PluginResult jsResult = PluginResultHelper.pluginResultFromEvent(event);

    //notify JS
    if (downloadJsCallback != null) {
        downloadJsCallback.sendPluginResult(jsResult);
        downloadJsCallback = null;
    }

    sendMessageToDefaultCallback(jsResult);
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:25,代码来源:HotCodePushPlugin.java

示例12: onMessageEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(ViewEvent event) {
    Bundle bundle = new Bundle();
    switch (event.getType()){
        case gotoFileClickPosition:
            FileData fileData = (FileData) event.getArgs().getSerializable(ViewEvent.Keys.GOTO_PATH);
            bundle.putSerializable(Constant.FILE_DATA_TYPE, FileDataType.gotoPath);
            bundle.putString(Constant.GOTO_PATH,fileData.getPath());
            items.clear();
            items.add(new HeaderData(fileData.getPath()));
            break;
        case backPath:
            HeaderData headerData = (HeaderData) event.getArgs().getSerializable(ViewEvent.Keys.BACK_PATH_HEADER);
            if(rootPath.equals(headerData.getPath())){
                Toasty.info(context,"当前为SD卡根目录",Toast.LENGTH_SHORT,true).show();
                return;
            }
            bundle.putSerializable(Constant.FILE_DATA_TYPE, FileDataType.backPath);
            bundle.putString(Constant.BACK_PATH,headerData.getPath());
            String parentPath = FileUtil.getParentPath(headerData.getPath());
            items.clear();
            items.add(new HeaderData(parentPath));
            break;
    }
    initLoader(bundle);
}
 
开发者ID:WeiMei-Tian,项目名称:FileBrowser,代码行数:27,代码来源:FileFragment.java

示例13: onEventMainThread

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EventStartMainThread mainThread) {
    mMergePath = mainThread.getPath();
    if (mainThread.isCreate()) {
        ProgressBarHelper.getInstance(false).dismiss();
        ViewAnimator.animate(mVoiceIndicatorView).fadeOut().accelerate().duration(600).start();
        ViewAnimator.animate(mLlShare).fadeIn().accelerate().duration(600)
                .onStart(() -> {
                    mViewPager.setVisibility(View.GONE);
                    mLlShare.setVisibility(View.VISIBLE);
                })
                .start();
    } else {
        ViewAnimator.animate(mVoiceIndicatorView).fadeIn().accelerate().duration(600).start();
        ViewAnimator.animate(mLlShare).fadeOut().accelerate().duration(600)
                .onStop(() -> {
                    mViewPager.setVisibility(View.VISIBLE);
                    mLlShare.setVisibility(View.GONE);
                })
                .start();
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:23,代码来源:TheHostVoiceMenuFragment.java

示例14: onMessageEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的package包/类
/**
 * Used by EventBus
 * Called when a Publisher send a state.
 * @param stateEvent
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(StateEvent stateEvent) {
    switch (stateEvent.getState()) {
        case CONNECTED: {
            Pandwarf.getInstance().setConnected(true);
            toastShow("Device Opened...");
            break;
        }
        case DISCONNECTED: {
            toastShow("Closing device...");
            Pandwarf.getInstance().setConnected(false);
            break;
        }
    }
}
 
开发者ID:GRnice,项目名称:PandwarfDefenderProject,代码行数:21,代码来源:Main2Activity.java

示例15: onRecordUpdateEvent

import org.greenrobot.eventbus.Subscribe; //导入依赖的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


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