<commit_before>package lt.vilnius.tvarkau.views.adapters;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import lt.vilnius.tvarkau.ProblemDetailActivity;
import lt.vilnius.tvarkau.R;
import lt.vilnius.tvarkau.entity.Problem;

/**
 * Created by <NAME> on 2016-01-13.
 */
public class ProblemsListAdapter
        extends RecyclerView.Adapter<ProblemsListAdapter.ViewHolder> {

    private Activity activity;
    private final List<Problem> mValues;

    public ProblemsListAdapter(Activity activity, List<Problem> items) {
        this.activity = activity;
        mValues = items;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.problem_list_content, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {
        Problem item = mValues.get(position);

        holder.item = item;

        holder.descriptionView.setText(item.getDescription());
        item.applyReportStatusLabel(item.getStatus(), holder.statusView);

        holder.titleView.setText(item.getTypeName());

        // TODO update to 10 min ago format if possible
        // holder.timeView.setText(DateUtils.getRelativeTimeSpanString(item.getUpdatedAt().getTime()));
        holder.timeView.setText(item.getReportDate());

        String thumbUrl = item.getThumbUrl();
        if (thumbUrl == null) {
            holder.thumbView.setVisibility(View.GONE);
        } else {
            holder.thumbView.setVisibility(View.VISIBLE);
            Glide.with(activity).load(thumbUrl).into(holder.thumbView);
        }

        holder.content.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = ProblemDetailActivity.getStartActivityIntent(activity, holder.item.getId());

                Bundle bundle = ActivityOptionsCompat.makeScaleUpAnimation(view, 0, 0,
                            view.getWidth(), view.getHeight()).toBundle();

                ActivityCompat.startActivity(activity, intent, bundle);
            }
        });
    }

    @Override
    public int getItemCount() {<commit_msg>Add centerCrop to list view images<commit_after>package lt.vilnius.tvarkau.views.adapters;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import lt.vilnius.tvarkau.ProblemDetailActivity;
import lt.vilnius.tvarkau.R;
import lt.vilnius.tvarkau.entity.Problem;

/**
 * Created by <NAME> on 2016-01-13.
 */
public class ProblemsListAdapter
        extends RecyclerView.Adapter<ProblemsListAdapter.ViewHolder> {

    private Activity activity;
    private final List<Problem> mValues;

    public ProblemsListAdapter(Activity activity, List<Problem> items) {
        this.activity = activity;
        mValues = items;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.problem_list_content, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {
        Problem item = mValues.get(position);

        holder.item = item;

        holder.descriptionView.setText(item.getDescription());
        item.applyReportStatusLabel(item.getStatus(), holder.statusView);

        holder.titleView.setText(item.getTypeName());

        // TODO update to 10 min ago format if possible
        // holder.timeView.setText(DateUtils.getRelativeTimeSpanString(item.getUpdatedAt().getTime()));
        holder.timeView.setText(item.getReportDate());

        String thumbUrl = item.getThumbUrl();
        if (thumbUrl == null) {
            holder.thumbView.setVisibility(View.GONE);
        } else {
            holder.thumbView.setVisibility(View.VISIBLE);
            Glide.with(activity).load(thumbUrl).centerCrop().into(holder.thumbView);
        }

        holder.content.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = ProblemDetailActivity.getStartActivityIntent(activity, holder.item.getId());

                Bundle bundle = ActivityOptionsCompat.makeScaleUpAnimation(view, 0, 0,
                            view.getWidth(), view.getHeight()).toBundle();

                ActivityCompat.startActivity(activity, intent, bundle);
            }
        });
    }

    @Override
    public int getItemCount() {
{'fraction_non_alphanumeric': 0.10194875496210755, 'fraction_numerical': 0.0054132082280765065, 'mean_word_length': 3.158289572393098, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1795542', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1495, 'n_words': 291}