<commit_before>package com.cloudycrew.cloudycar;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cloudycrew.cloudycar.models.requests.AcceptedRequest;
import com.cloudycrew.cloudycar.models.requests.ConfirmedRequest;
import com.cloudycrew.cloudycar.models.requests.PendingRequest;
import com.cloudycrew.cloudycar.models.requests.Request;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by insanekillah on 2016-11-08.
 */

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

    private List<Request> requestList;
    private List<PendingRequest> pendingRequests;
    private List<AcceptedRequest> acceptedRequests;

    private final int PENDING_REQUEST = 0;
    private final int ACCEPTED_REQUEST = 1;
    private final int CONFIRMED_REQUEST = 2;

    // Set up an interface to listen to clicks in the ViewHolder from an activity
    public interface CustomClickListener {
        void onItemClick(View view, Request request);
    }

    private CustomClickListener listener;

    // callable from MainActivity to call request actions from there
    public void setClickListener(CustomClickListener listener) {
        this.listener = listener;
    }

    public RequestAdapter() {
        requestList = new ArrayList<>();
        pendingRequests = new ArrayList<>();
        acceptedRequests = new ArrayList<>();
    }

    public abstract class ViewHolder extends RecyclerView.ViewHolder {
        public TextView requestDest;
        public TextView requestSrc;

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

            final ViewHolder vh = this;

            // clicking on a list item other than the complete button
            view.setOnClickListener((v) -> {
                int position = getAdapterPosition();
                if (position != RecyclerView.NO_POSITION) {
                    listener.onItemClick(view, requestList.get(position));
                }
            });
        }
    }

    // these classes hold each of the views that comprise a given item in the request list
    public class PendingViewHolder extends ViewHolder {

        public PendingViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.pending_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.pending_request_src);
        }
    }

    public class AcceptedViewHolder extends ViewHolder {

        public TextView requestDest;
        public TextView requestSrc;
        public TextView requestAcceptedBy;

        public AcceptedViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.accepted_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.accepted_request_src);
            requestAcceptedBy = (TextView) view.findViewById(R.id.accepted_request_acceptedby);
        }
    }

    public class ConfirmedViewHolder extends ViewHolder {

        public TextView requestDest;
        public TextView requestSrc;
        public TextView requestAcceptedBy;

        public ConfirmedViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.confirmed_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.confirmed_request_src);
            requestAcceptedBy = (TextView) view.findViewById(R.id.confirmed_request_acceptedby);
        }
    }

    @Override
    public int getItemViewType(int position) {
        if (requestList.get(position) instanceof PendingRequest) {
            return PENDING_REQUEST;
        } else if (requestList.get(position) instanceof AcceptedRequest) {
            return ACCEPTED_REQUEST;
        } else if (requestList.get(position) instanceof ConfirmedRequest) {
            return CONFIRMED_REQUEST;
        }
        return -1;
    }<commit_msg>Getting in sync with github<commit_after>package com.cloudycrew.cloudycar;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cloudycrew.cloudycar.models.requests.AcceptedRequest;
import com.cloudycrew.cloudycar.models.requests.ConfirmedRequest;
import com.cloudycrew.cloudycar.models.requests.PendingRequest;
import com.cloudycrew.cloudycar.models.requests.Request;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by insanekillah on 2016-11-08.
 */

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

    private List<Request> requestList;
    private List<PendingRequest> pendingRequests;
    private List<AcceptedRequest> acceptedRequests;

    private final int PENDING_REQUEST = 0;
    private final int ACCEPTED_REQUEST = 1;
    private final int CONFIRMED_REQUEST = 2;

    // Set up an interface to listen to clicks in the ViewHolder from an activity
    public interface CustomClickListener {
        void onItemClick(View view, Request request);
    }

    private CustomClickListener listener;

    // callable from MainActivity to call request actions from there
    public void setClickListener(CustomClickListener listener) {
        this.listener = listener;
    }

    public RequestAdapter() {
        requestList = new ArrayList<>();
        pendingRequests = new ArrayList<>();
        acceptedRequests = new ArrayList<>();
    }

    public abstract class ViewHolder extends RecyclerView.ViewHolder {
        public TextView requestDest;
        public TextView requestSrc;

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

            final ViewHolder vh = this;

            // clicking on a list item other than the complete button
            view.setOnClickListener((v) -> {
                int position = getAdapterPosition();
                if (position != RecyclerView.NO_POSITION) {
                    listener.onItemClick(view, requestList.get(position));
                }
            });
        }
    }

    // these classes hold each of the views that comprise a given item in the request list
    public class PendingViewHolder extends ViewHolder {

        public PendingViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.pending_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.pending_request_src);
        }
    }

    public class AcceptedViewHolder extends ViewHolder {

        public TextView requestAcceptedBy;

        public AcceptedViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.accepted_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.accepted_request_src);
            requestAcceptedBy = (TextView) view.findViewById(R.id.accepted_request_acceptedby);
        }
    }

    public class ConfirmedViewHolder extends ViewHolder {

        public TextView requestAcceptedBy;

        public ConfirmedViewHolder(final View view) {
            super(view);

            requestDest = (TextView) view.findViewById(R.id.confirmed_request_dest);
            requestSrc = (TextView) view.findViewById(R.id.confirmed_request_src);
            requestAcceptedBy = (TextView) view.findViewById(R.id.confirmed_request_acceptedby);
        }
    }

    @Override
    public int getItemViewType(int position) {
        if (requestList.get(position) instanceof PendingRequest) {
            return PENDING_REQUEST;
        } else if (requestList.get(position) instanceof AcceptedRequest) {
            return ACCEPTED_REQUEST;
        } else if (requestList.get(position) instanceof ConfirmedRequest) {
            return CONFIRMED_REQUEST;
        }
        return -1;
    }
{'fraction_non_alphanumeric': 0.0763854218671992, 'fraction_numerical': 0.0032451323015476783, 'mean_word_length': 2.832137733142037, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '2655060', 'n_tokens_mistral': 2143, 'n_tokens_neox': 2043, 'n_words': 524}