本文整理汇总了Java中de.greenrobot.event.Subscribe类的典型用法代码示例。如果您正苦于以下问题:Java Subscribe类的具体用法?Java Subscribe怎么用?Java Subscribe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Subscribe类属于de.greenrobot.event包,在下文中一共展示了Subscribe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCategoryDeleteEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onCategoryDeleteEvent(CategoryDeleteEvent categoryDeleteEvent) {
mRxCategory.getAllCategories()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> {
int beforeCategoryId = mCategoryId;
for (Category category : categories) {
if (category.isCheck()) {
mCategoryId = category.getId();
break;
}
}
mHomeView.updateCategoryList(categories);
if (mCategoryId != beforeCategoryId) {
mHomeView.changePhotos4Category(mCategoryId);
}
});
}
示例2: onDrawerItemClick
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onDrawerItemClick(DrawerItemClick clickEvent) {
if (drawerLayout != null)
drawerLayout.closeDrawer(recyclerView);
if (clickEvent.getPosition() == DrawerItemClick.MOVIE_POSITION) {
if (currentFragment != MOVIES_FRAGMENT)
resetSearchView();
currentFragment = MOVIES_FRAGMENT;
setupFragment();
} else if (clickEvent.getPosition() == DrawerItemClick.PEOPLE_POSITION) {
if (currentFragment != PEOPLE_FRAGMENT)
resetSearchView();
currentFragment = PEOPLE_FRAGMENT;
setupFragment();
}
}
示例3: onEventMainThread
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
/**
* 收到收藏状态发生变化事件时
*
* @param event
*/
@Subscribe
public void onEventMainThread(final FavoriteChangeEvent event) {
if (event != null && event.getFavoritePlate() != null) {
List<Plate> favoritePlate = event.getFavoritePlate();
int index = favoritePlate.indexOf(mPlate);
if (index != -1) {
Plate plate = favoritePlate.get(index);
this.mPlate.setFavoriteId(plate.getFavoriteId());
this.mPlateHeadView.setFavorite(plate.isFavorite());
} else {
this.mPlate.setFavoriteId(null);
this.mPlateHeadView.setFavorite(false);
}
}
}
示例4: onEventMainThread
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe //在ui线程执行
public void onEventMainThread(SendEvent event) {
if (event != null) {
CircleVO circleVO = event.getMsg();
mArrayList.add(0,circleVO);
mAdapter.notifyDataSetChanged();
}
}
示例5: onPhotoNoteCreateEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onPhotoNoteCreateEvent(PhotoNoteCreateEvent photoNoteCreateEvent) {
mRxPhotoNote.findByCategoryId(mCategoryId, ComparatorFactory.FACTORY_NOT_SORT)
.subscribe(photoNoteList -> {
mRxCategory.findByCategoryId(mCategoryId)
.subscribe(category -> {
category.setPhotosNumber(photoNoteList.size());
mRxCategory.updateCategory(category)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> {
mHomeView.updateCategoryList(categories);
});
});
});
}
示例6: onPhotoNoteDeleteEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onPhotoNoteDeleteEvent(PhotoNoteDeleteEvent photoNoteDeleteEvent) {
mRxPhotoNote.findByCategoryId(mCategoryId, ComparatorFactory.FACTORY_NOT_SORT)
.subscribe(photoNoteList -> {
mRxCategory.findByCategoryId(mCategoryId)
.subscribe(category -> {
category.setPhotosNumber(photoNoteList.size());
mRxCategory.updateCategory(category)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> {
mHomeView.updateCategoryList(categories);
});
});
});
}
示例7: finishEventBus
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe
public void finishEventBus(String string){
if(string.equals("finishRun")){
if(connection != null){
unbindService(connection);
}
Intent intent2 = new Intent(RunningActivity.this,RunQueryHistoryActivity.class);
startActivity(intent2);
//停止计时器
takeTimeHandler.removeCallbacks(takeTimeRunnable);
RunQueryHistoryActivity.finishRunTime = getCurrentTime();
onDestroy();
}
}
示例8: onEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe
public void onEvent(TopStoriesEvent event) {
if (event.stories != null) {
topStories.addAll(event.stories);
topStoryAdapter.notifyDataSetChanged();
collapsingToolbar.setTitle(topStories.get(0).getTitle());
}
}
示例9: onAskedToSearchCategories
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.Async)
public void onAskedToSearchCategories(EventMyList.EventFetch event) {
if (isCorrectEventFetch(event)) {
EventFetched<T> result = new EventFetched<>(getListOfItem());
EventBus.getDefault().post(result);
}
}
示例10: onFetchedCategories
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onFetchedCategories(EventFetched<T> event) {
List list = event.result;
if (list != null && list.size() > 0 && isCorrectInstance(list.get(0))) {
updateUpdate(event);
}
}
示例11: onEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread, sticky = true)
public void onEvent(SyncResult event) {
if (event.finished) {
_progress_bar.setVisibility(View.GONE);
_start_sync.setVisibility(View.VISIBLE);
} else {
_progress_bar.setVisibility(View.VISIBLE);
_start_sync.setVisibility(View.GONE);
}
}
示例12: onEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.Async)
public void onEvent(PostRefreshAmiibos event) {
List<AmiiboDescriptorInformation> list = event.amiibos;
if (list != null) {
for (AmiiboDescriptorInformation amiibo : list) {
Log.d("ApplicationController", "writing amiibo " + amiibo.identifier + " " + amiibo.name);
AmiiboFactory.getAmiiboDescriptorCache()
.updateInDatabase(amiibo.asAmiiboDescriptor());
}
}
}
示例13: onCategoryCreateEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onCategoryCreateEvent(CategoryCreateEvent categoryCreateEvent) {
mRxCategory.getAllCategories()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> mHomeView.updateCategoryList(categories));
}
示例14: onCategoryUpdateEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onCategoryUpdateEvent(CategoryUpdateEvent categoryUpdateEvent) {
mRxCategory.getAllCategories()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> mHomeView.updateCategoryList(categories));
}
示例15: onCategoryMoveEvent
import de.greenrobot.event.Subscribe; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MainThread)
public void onCategoryMoveEvent(CategoryMoveEvent categoryMoveEvent) {
mRxCategory.getAllCategories()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(categories -> mHomeView.updateCategoryList(categories));
}