package es.craftsmanship.toledo.katangapp.activities;

import es.craftsmanship.toledo.katangapp.models.RouteResult;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import android.support.v7.widget.RecyclerView;

import android.widget.TextView;

import java.util.List;

/**
 * author Cristóbal Hermida
 */
public class LinesAdapter extends RecyclerView.Adapter<LinesAdapter.LinesHolder> {

    private List<RouteResult> lines;

    public LinesAdapter(List<RouteResult> lines) {
        this.lines = lines;
    }

    @Override
    public LinesHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new LinesHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.row, parent, false));
    }

    @Override
    public void onBindViewHolder(LinesHolder holder, int position) {
        holder.bind(lines.get(position));
    }

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

    static class LinesHolder extends RecyclerView.ViewHolder{
        private final TextView linea;
        private final TextView tiempo;

        public LinesHolder(View itemView) {
            super(itemView);
            linea = (TextView) itemView.findViewById(R.id.linea);
            tiempo = (TextView) itemView.findViewById(R.id.tiempo);



        }

            linea.setText(route.getIdl());
            tiempo.setText(String.valueOf(route.getTime()));


        public void bind(RouteResult route) {
        }
    }

}

@@ -1035,17 +1035,19 @@
 ewHolder
-%7B
+ %7B%0A
 %0A       
@@ -1074,17 +1074,16 @@
 iew line
-a
 ;%0A      
@@ -1109,20 +1109,18 @@
 tView ti
+m
 e
-mpo
 ;%0A%0A     
@@ -1203,17 +1203,16 @@
     line
-a
  = (Text
@@ -1266,20 +1266,18 @@
       ti
+m
 e
-mpo
  = (Text
@@ -1318,19 +1318,16 @@
 iempo);%0A
-%0A%0A%0A
         
@@ -1329,32 +1329,74 @@
      %7D%0A%0A    
+    public void bind(RouteResult route) %7B%0A
         
 linea.setTex
@@ -1383,21 +1383,24 @@
         
+    
 line
-a
 .setText
@@ -1431,20 +1431,18 @@
       ti
+m
 e
-mpo
 .setText
@@ -1480,56 +1480,8 @@
 ));%0A
-%0A%0A        public void bind(RouteResult route) %7B%0A
     

rename spanish fields