作家
登录

浅淡MVP的实战演习,让代码结构更简单~

作者: 来源: 2017-05-15 09:52:41 阅读 我要评论

            holder.setTextViewText(R.id.category_item_author, resultsBean.who == null ? "unknown" : resultsBean.who); 
  •             holder.setTextViewText(R.id.category_item_time, TimeUtil.dateFormat(resultsBean.publishedAt)); 
  •             holder.setTextViewText(R.id.category_item_src, resultsBean.source == null ? "unknown" : resultsBean.source); 
  •             holder.setOnClickListener(this, R.id.category_item_layout); 
  •         } 
  •     }    @Override 
  •     public void onClick(View v, int position, CommonRecyclerHolder holder) { 
  •         //Toasty.info(mContext,"跳转到响应网页!", Toast.LENGTH_SHORT,true).show(); 
  •         Intent intent = new Intent(mContext, WebViewActivity.class); 
  •         intent.putExtra(WebViewActivity.GANK_TITLE, mData.get(position).desc); 
  •         intent.putExtra(WebViewActivity.GANK_URL, mData.get(position).url); 
  •         mContext.startActivity(intent); 
  •     } 
  •  
  • 最后当然是 Fragment。

    1. public class CategoryFragment extends BaseFragment implements ICategoryView, OnRefreshListener, OnLoadMoreListener {     
    2. public static final String CATEGORY_NAME = "com.nanchen.aiyagirl.module.category.CategoryFragment.CATEGORY_NAME";     
    3. @BindView(R.id.recyclerView) 
    4.     RecyclerViewWithFooter mRecyclerView;     
    5.     @BindView(R.id.swipe_refresh_layout) 
    6.     SwipeRefreshLayout mSwipeRefreshLayout;     
    7.         private String categoryName;     
    8.         private CategoryRecyclerAdapter mAdapter;     
    9.         private ICategoryPresenter mICategoryPresenter;     
    10.         public static CategoryFragment newInstance(String mCategoryName) { 
    11.         CategoryFragment categoryFragment = new CategoryFragment(); 
    12.         Bundle bundle = new Bundle(); 
    13.         bundle.putString(CATEGORY_NAME, mCategoryName); 
    14.         categoryFragment.setArguments(bundle);         
    15.         

        推荐阅读

        pyspider爬虫教程 (2):AJAX和HTTP

      在上一篇教程《pyspider 爬虫教程 (1):HTML 和 CSS 选择》中,我们应用 self.crawl API 抓取豆瓣片子的 HTML 内容,并应用 CSS 选择器解析了一些内容。不过,如今的网站经由过程应用 AJA>>>详细阅读


      本文标题:浅淡MVP的实战演习,让代码结构更简单~

      地址:http://www.17bianji.com/lsqh/35192.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)