本文整理汇总了Java中org.simple.eventbus.Subscriber类的典型用法代码示例。如果您正苦于以下问题:Java Subscriber类的具体用法?Java Subscriber怎么用?Java Subscriber使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Subscriber类属于org.simple.eventbus包,在下文中一共展示了Subscriber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
/**
* 通过eventbus post事件,远程遥控执行对应方法
*/
@Subscriber(tag = APPMANAGER_MESSAGE, mode = ThreadMode.MAIN)
public void onReceive(Message message) {
switch (message.what) {
case START_ACTIVITY:
if (message.obj == null)
break;
dispatchStart(message);
break;
case SHOW_SNACKBAR:
if (message.obj == null)
break;
showSnackbar((String) message.obj, message.arg1 == 0 ? false : true);
break;
case KILL_ALL:
killAll();
break;
case APP_EXIT:
AppExit();
break;
}
}
示例2: onReceive
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
/**
* 通过eventbus post事件,远程遥控执行对应方法
*/
@Subscriber(tag = APPMANAGER_MESSAGE, mode = ThreadMode.MAIN)
public void onReceive(Message message) {
switch (message.what) {
case START_ACTIVITY:
if (message.obj == null)
break;
dispatchStart(message);
break;
case SHOW_SNACKBAR:
if (message.obj == null)
break;
showSnackbar((String) message.obj, message.arg1 == 0 ? false : true);
break;
case KILL_ALL:
killAll();
break;
case APP_EXIT:
appExit();
break;
default:
Timber.tag(TAG).w("The message.what not match");
break;
}
}
示例3: onReceive
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
/**
* 通过eventbus post事件,远程遥控执行对应方法
* tag 区分事件类型
*/
@Subscriber(tag = APPMANAGER_MESSAGE, mode = ThreadMode.MAIN)
public void onReceive(Message message) {
switch (message.what) {
case START_ACTIVITY:
if (message.obj == null)
break;
dispatchStart(message);
break;
case SHOW_SNACKBAR:
if (message.obj == null)
break;
showSnackbar((String) message.obj, message.arg1 == 0 ? false : true);
break;
case KILL_ALL:
killAll();
break;
case APP_EXIT:
AppExit();
break;
}
}
示例4: onReceive
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
/**
* 通过 eventbus post 事件,远程遥控执行对应方法
*/
@Subscriber(tag = APPMANAGER_MESSAGE, mode = ThreadMode.MAIN)
public void onReceive(Message message) {
switch (message.what) {
case START_ACTIVITY:
if (message.obj == null)
break;
dispatchStart(message);
break;
case SHOW_SNACKBAR:
if (message.obj == null)
break;
showSnackbar((String) message.obj, message.arg1 == 0 ? false : true);
break;
case KILL_ALL:
killAll();
break;
case APP_EXIT:
appExit();
break;
default:
Timber.tag(TAG).w("The message.what not match");
break;
}
if (mHandleListener != null) {
mHandleListener.handleMessage(this, message);
}
}
示例5: onReceive
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
/**
* 通过 {@link EventBus#post(Object)} 事件, 远程遥控执行对应方法
* 可通过 {@link #setHandleListener(HandleListener)}, 让外部可扩展新的事件
*/
@Subscriber(tag = APPMANAGER_MESSAGE, mode = ThreadMode.MAIN)
public void onReceive(Message message) {
switch (message.what) {
case START_ACTIVITY:
if (message.obj == null)
break;
dispatchStart(message);
break;
case SHOW_SNACKBAR:
if (message.obj == null)
break;
showSnackbar((String) message.obj, message.arg1 == 0 ? false : true);
break;
case KILL_ALL:
killAll();
break;
case APP_EXIT:
appExit();
break;
default:
Timber.tag(TAG).w("The message.what not match");
break;
}
if (mHandleListener != null) {
mHandleListener.handleMessage(this, message);
}
}
示例6: refrshData
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.REFRESH_HOME_DATA)
public void refrshData(String s){
if (mSwipeRefresh.isRefreshing()){
return;
}
mSwipeRefresh.setRefreshing(true);
mPresenter.getIndexVideoList(lastStartId,true,page);
}
示例7: downloadPending
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.CACHE_DOWNLOAD_PENDING)
private void downloadPending(String id) {
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getId().toString().equals(id)) {
data.get(i).setPending(true);
adapter.notifyItemChanged(i);
}
}
}
示例8: downloadProgress
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.CACHE_DOWNLOAD_PROGRESS)
private void downloadProgress(DownloadProgressInfo progressInfo) {
VideoDownLoadInfo item = data.get(currentPosition);
item.setDownLoading(true);
item.setPending(false);
item.setCurrentBytes((long)progressInfo.getCurrentBytes());
item.setContentLength((long)progressInfo.getContentLength());
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getId().toString().equals(progressInfo.getId())) {
currentPosition = i;
changePosition = i;
showDownload(i);
}
}
}
示例9: downloadCancel
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.CACHE_DOWNLOAD_CACNCEL)
private void downloadCancel(Long id) {
// if (id.equals(-1L)){
int position = -1;
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getId().equals(id)) {
position = i;
}
}
if (position >= 0) {
if (data.get(position).getDownLoading()) {
hideDownload(position);
} else {
showDownload(position);
Intent intent = new Intent(getActivity(), DownLoadService.class);
intent.putExtra(DownLoadService.VIDEOS_INFO, data.get(position));
intent.putExtra(DownLoadService.VIDEOS_INSERT, false);
getActivity().startService(intent);
}
}
// }else {
// for (int i=0;i<data.size();i++){
// if (data.get(i).getId().equals(id)){
// currentPosition = i;
// changePosition = i;
// data.get(i).setLineUp(false);
// }
// }
// showDownload();
// }
}
示例10: downloadBegin
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.CACHE_DOWNLOAD_BEGIN)
private void downloadBegin(VideoDownLoadInfo info) {
Timber.e("-------------getSticky");
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getId().equals(info.getId())) {
currentPosition = i;
changePosition = i;
data.get(i).setLineUp(true);
adapter.notifyItemChanged(i);
}
}
}
示例11: setUserInfo
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.SET_USER_INFO)
public void setUserInfo(User user) {
mTvName.setText(User.getCurrentUser().getUsername());
if (user.getIcon() != null){
BmobFile file = user.getIcon();
appComponent.imageLoader().loadImage(getActivity(), ImageConfigImpl
.builder()
.url(file.getFileUrl())
.imageView(mCivFace)
.dontAnimate(true)
.placeholder(R.drawable.ic_noface)
.errorPic(R.drawable.ic_noface)
.build());
}
}
示例12: setUserInfo
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.SET_USER_INFO)
public void setUserInfo(User user) {
if (!"all".equals(type) && user != null) {
mPresenter.getMyAttentionList(user.getObjectId());
mSwipeRefresh.setEnabled(true);
}
}
示例13: startAnimate
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.HIDE_RECYCLERVIEW)
public void startAnimate(View view,boolean isShow) {
if (isShow) {
AnimationUtils.startTranslate(view, 0, dragBottomView.getHeight()
, 0, 0, 200, true);
setSwipeBackEnable(false);
} else {
AnimationUtils.startTranslate(view, 0, 0
, 0, dragBottomView.getHeight(), 200, false);
setSwipeBackEnable(true);
}
}
示例14: goToHomePage
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.JUMP_TO_HOME)
public void goToHomePage(String s) {
if (isAnimated){
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
// TRouter.go(Constants.MAIN);
finish();
}
}
示例15: setUserInfo
import org.simple.eventbus.Subscriber; //导入依赖的package包/类
@Subscriber(tag = EventBusTags.SET_USER_INFO)
public void setUserInfo(User user) {
CircleImageView img = (CircleImageView) mNvMainNavigation.getHeaderView(0).findViewById(R.id.im_face);
TextView name = (TextView) mNvMainNavigation.getHeaderView(0).findViewById(R.id.tv_name);
name.setText(User.getCurrentUser().getUsername());
if (user.getIcon() != null) {
appComponent.imageLoader().loadImage(this,
ImageConfigImpl
.builder()
.transformation(new GlideCircleTransform())
.url(user.getIcon().getFileUrl())
.errorPic(R.drawable.ic_noface)
.dontAnimate(true)
.imageView(img)
.build());
}
BmobQuery<MyAttentionEntity> query = new BmobQuery<MyAttentionEntity>();
query.addWhereEqualTo("userId", BmobUser.getCurrentUser().getObjectId());
query.order("-createdAt");
query.findObjects(new FindListener<MyAttentionEntity>() {
@Override
public void done(List<MyAttentionEntity> list, BmobException e) {
appComponent.extras().put(Constants.CACHE_FOLLOWED_INFO,list);
}
});
}