@@ -0,0 +1,2472 @@
+package com.sedsoftware.xyzreader.ui;%0A%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.ImageView;%0Aimport android.widget.TextView;%0Aimport butterknife.BindView;%0Aimport butterknife.ButterKnife;%0Aimport com.bumptech.glide.Glide;%0Aimport com.bumptech.glide.load.engine.DiskCacheStrategy;%0Aimport com.sedsoftware.xyzreader.R;%0Aimport com.sedsoftware.xyzreader.data.model.Article;%0Aimport com.sedsoftware.xyzreader.utils.StringUtils;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport timber.log.Timber;%0A%0Apublic class ArticlesAdapter extends RecyclerView.Adapter%3CArticlesAdapter.ViewHolder%3E %7B%0A%0A  private List%3CArticle%3E articles = new ArrayList%3C%3E();%0A%0A  @Override%0A  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) %7B%0A    View view = LayoutInflater.from(parent.getContext())%0A        .inflate(R.layout.list_item_article, parent, false);%0A%0A    return new ViewHolder(view);%0A  %7D%0A%0A  @Override%0A  public void onBindViewHolder(ViewHolder holder, int position) %7B%0A    holder.bindTo(articles.get(position));%0A  %7D%0A%0A  @Override%0A  public int getItemCount() %7B%0A    return articles.size();%0A  %7D%0A%0A  @Override%0A  public long getItemId(int position) %7B%0A    return articles.get(position).id();%0A  %7D%0A%0A  public void addArticle(Article article) %7B%0A    articles.add(article);%0A    notifyItemInserted(articles.size() - 1);%0A  %7D%0A%0A  public void clearList() %7B%0A    articles.clear();%0A  %7D%0A%0A  class ViewHolder extends RecyclerView.ViewHolder %7B%0A%0A    @BindView(R.id.item_thumbnail)%0A    ImageView thumbnailView;%0A    @BindView(R.id.item_article_title)%0A    TextView titleView;%0A    @BindView(R.id.item_article_subtitle)%0A    TextView subtitleView;%0A%0A    ViewHolder(View view) %7B%0A      super(view);%0A      ButterKnife.bind(this, view);%0A    %7D%0A%0A    void bindTo(Article article) %7B%0A%0A      String title = article.title();%0A      Timber.tag(%22myxyzreader%22).d(%22ARTICLE TITLE FROM BIND: %22 + title);%0A      String rawDate = article.published_date();%0A      String author = article.author();%0A%0A      titleView.setText(title);%0A      subtitleView.setText(StringUtils.getFormattedSubtitle(rawDate, author));%0A%0A      String thumbnailUrl = article.thumb();%0A%0A      Glide.clear(thumbnailView);%0A%0A      Glide.clear(thumbnailView);%0A      Glide.with(thumbnailView.getContext())%0A          .load(thumbnailUrl)%0A          .fitCenter()%0A          .diskCacheStrategy(DiskCacheStrategy.ALL)%0A          .into(thumbnailView);%0A    %7D%0A  %7D%0A%7D%0A

Add ArticleList adapter