Пример #1
0
 @Override
 public void onClick(int _Position) {
   News news = getItem(_Position);
   BusProvider.getInstance()
       .post(
           new FragmentChangeEvent(
               NewsDetailFragment.newInstance(
                   NetworkUtils.getNewsUrl(news.getmCategory().getmId(), news.getmThreadId()))));
 }
Пример #2
0
  @Override
  public void onBindViewHolder(RecyclerView.ViewHolder _ViewHolder, int _Position) {
    News news = getItem(_Position);
    NewsViewHolder newsViewHolder = (NewsViewHolder) _ViewHolder;
    Picasso.with(m_Context)
        .load(NetworkUtils.getNewsImageUrl(news.getmId(), news.getmImageId()))
        .fit()
        .centerCrop()
        .tag(_ViewHolder)
        .error(R.mipmap.no_image)
        .into(newsViewHolder.image);
    newsViewHolder.newsTitle.setText(news.getmTitle());
    newsViewHolder.setPosition(_Position);

    // check if we need to reload some more data
    if (_Position >= getItemCount() - 1) {
      // event to load some more data
      BusProvider.getInstance().post(new LoadNewsFromWebEvent(news.getmId() - 1));
    }
  }