package de.metalmatze.krautreporter.adapters;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.text.SimpleDateFormat;
import java.util.List;

import de.metalmatze.krautreporter.R;
import de.metalmatze.krautreporter.activities.ArticleActivity;
import de.metalmatze.krautreporter.entities.Article;

public class ArticleRecyclerViewAdapter extends RecyclerView.Adapter<ArticleRecyclerViewAdapter.ViewHolder> {

    private List<Article> articles;
    private Article article;

    public ArticleRecyclerViewAdapter(List<Article> articles) {
        this.articles = articles;
    }

    @Override
    public ArticleRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View itemView = LayoutInflater
                .from(viewGroup.getContext())
                .inflate(R.layout.article_list, viewGroup, false);

        return new ViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(ArticleRecyclerViewAdapter.ViewHolder viewHolder, int position) {

        this.article = this.articles.get(position);

        String articleDate = new SimpleDateFormat("dd.MM.yyyy").format(article.getDate().getTime());
        viewHolder.article_date.setText(articleDate);
        viewHolder.article_headline.setText(article.getTitle());
    }

    @Override
    public int getItemCount() {
        return this.articles.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        public TextView article_date;
        public TextView article_headline;

        public ViewHolder(final View itemView) {
            super(itemView);

            this.article_date = (TextView) itemView.findViewById(R.id.article_list_date);
            this.article_headline = (TextView) itemView.findViewById(R.id.article_list_headline);

            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Context context = itemView.getContext();

                    Intent intent = new Intent(context, ArticleActivity.class);
                    context.startActivity(intent);
                }
            });
        }
    }
}

@@ -475,15 +475,13 @@
 ter.
-entitie
+model
 s.Ar
@@ -485,16 +485,21 @@
 .Article
+Model
 ;%0A%0Apubli
@@ -620,32 +620,37 @@
 ate List%3CArticle
+Model
 %3E articles;%0A    
@@ -664,16 +664,21 @@
  Article
+Model
  article
@@ -730,16 +730,21 @@
 %3CArticle
+Model
 %3E articl
@@ -1353,17 +1353,12 @@
 cle.
-getD
+d
 ate
-()
 .get
@@ -1476,18 +1476,13 @@
 cle.
-getT
+t
 itle
-()
 );%0A 
@@ -2272,16 +2272,75 @@
 class);%0A
+                    intent.putExtra(%22uuid%22, article.uuid);%0A
         

Use ArticleModel in ArticleRecyclerViewAdapter