1)加载数据的过程中显示加载的进度条;
2)加载数据成功提示 Adapter 刷新数据;
3)加载掉败谈窗提示用户相干信息;
4)加载停止隐蔽进度条;
- public interface CategoryContract {
- interface ICategoryView extends BaseView{
- void getCategoryItemsFail(String failMessage);
- void setCategoryItems(CategoryResult categoryResult);
- void addCategoryItems(CategoryResult categoryResult);
- void showSwipeLoading();
- void hideSwipeLoading();
- void setLoading();
- String getCategoryName();
- void noMore();
- } interface ICategoryPresenter extends BasePresenter{
- void getCategoryItems(boolean isRefresh);
- }
- }
- public class CategoryPresenter implements ICategoryPresenter {
- private ICategoryView mCategoryICategoryView;
- private int mPage = 1;
- private Subscription mSubscription;
- public CategoryPresenter(ICategoryView androidICategoryView) {
- mCategoryICategoryView = androidICategoryView;
- }
- @Override
- public void subscribe() {
- getCategoryItems(true);
- }
- @Override
- public void unSubscribe() {
- if (mSubscription != null && !mSubscription.isUnsubscribed()){
- mSubscription.unsubscribe();
- }
- } @Override
- public void getCategoryItems(final boolean isRefresh) {
- if (isRefresh) {
- mPage = 1;
- mCategoryICategoryView.showSwipeLoading();
推荐阅读
在上一篇教程《pyspider 爬虫教程 (1):HTML 和 CSS 选择》中,我们应用 self.crawl API 抓取豆瓣片子的 HTML 内容,并应用 CSS 选择器解析了一些内容。不过,如今的网站经由过程应用 AJA>>>详细阅读
本文标题:浅淡MVP的实战演习,让代码结构更简单~
地址:http://www.17bianji.com/lsqh/35192.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示