ZhihuDailyListViewModel.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:LiteReader 作者:
private void initActions() {
    onLoadLatestNews = new Action1<ZhihuDailyList>() {
        @Override
        public void call(ZhihuDailyList list) {
            initBanner(list.topStories);
            getAdapter().add(new ZhihuDateItemViewModel(R.string.special_section));
            getAdapter().add(section);
            getAdapter().add(new ZhihuDateItemViewModel(R.string.latest_daily));
            initNews(list.stories);
            hideRefreshing();
            loadSections();
            setIsLoadingMore(false);
            enableLoadMore();
        }
    };
    onRefreshLatestNews = new Action1<ZhihuDailyList>() {
        @Override
        public void call(ZhihuDailyList list) {
            getAdapter().clear();
            getAdapter().add(banner);
            getAdapter().add(new ZhihuDateItemViewModel(R.string.special_section));
            getAdapter().add(section);
            updateBanner(list.topStories);
            getAdapter().add(new ZhihuDateItemViewModel(R.string.latest_daily));
            initNews(list.stories);
            hideRefreshing();
            loadSections();
            setIsLoadingMore(false);
            enableLoadMore();
            date = new Date();          //重置日期
        }
    };
    onDailyItemClick = new Action3<String, Integer, Integer>() {
        @Override
        public void call(String id, Integer touchX, Integer touchY) {
            Intent intent = ZhihuStoryDetailActivity.intentFor(getContext());
            intent.putExtra(Constant.EXTRA_ZHIHU_STORY_ID, id);
            intent.putExtra(Constant.EXTRA_TOUCH_X, touchX);
            intent.putExtra(Constant.EXTRA_TOUCH_Y, touchY);
            getContext().startActivity(intent);
        }
    };
    onSectionItemClick = new Action2<String, String>() {
        @Override
        public void call(String id, String name) {
            Intent intent = ZhihuSectionDetailActivity.intentFor(getContext());
            intent.putExtra(Constant.EXTRA_ZHIHU_SECTION_ID, id);
            intent.putExtra(Constant.EXTRA_ZHIHU_SECTION_NAME, name);
            getContext().startActivity(intent);
        }
    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号