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


Java Subscribe类代码示例

本文整理汇总了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);
                }
            });

}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:20,代码来源:HomePresenterImpl.java

示例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();
    }
}
 
开发者ID:JohnnyZhou,项目名称:MovieMe,代码行数:20,代码来源:MainActivity.java

示例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);
        }
    }
}
 
开发者ID:fei-ke,项目名称:ChipHellClient,代码行数:21,代码来源:ThreadListFragment.java

示例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();

    }
}
 
开发者ID:Alex-Jerry,项目名称:LLApp,代码行数:10,代码来源:CirleFragment.java

示例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);
                                    });
                        });
            });
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:16,代码来源:HomePresenterImpl.java

示例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);
                                    });
                        });
            });
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:16,代码来源:HomePresenterImpl.java

示例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();
	}
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:16,代码来源:RunningActivity.java

示例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());
    }
}
 
开发者ID:liuguangqiang,项目名称:Idaily,代码行数:9,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:codlab,项目名称:amiibo,代码行数:8,代码来源:AbstractLoadableFragment.java

示例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);
    }
}
 
开发者ID:codlab,项目名称:amiibo,代码行数:8,代码来源:AbstractLoadableFragment.java

示例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);
    }
}
 
开发者ID:codlab,项目名称:amiibo,代码行数:11,代码来源:DriveFragment.java

示例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());
        }
    }
}
 
开发者ID:codlab,项目名称:amiibo,代码行数:12,代码来源:ApplicationController.java

示例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));
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:7,代码来源:HomePresenterImpl.java

示例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));
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:7,代码来源:HomePresenterImpl.java

示例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));
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:7,代码来源:HomePresenterImpl.java


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