package es.craftsmanship.toledo.katangapp.activities;

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

import android.support.v7.widget.RecyclerView;

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

import android.widget.TextView;

import java.util.List;

/**
 * @author Javier Gamarra
 */
public class StopsAdapter extends RecyclerView.Adapter<StopsAdapter.StopsViewHolder> {

    private final List<BusStopResult> stops;

    public StopsAdapter(List<BusStopResult> stops) {
        this.stops = stops;
    }

    @Override
    public StopsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.stop, parent, false);

        return new StopsViewHolder(view);
    }

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

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

    public class StopsViewHolder extends RecyclerView.ViewHolder {

        private final TextView address;
        private final TextView distance;

        public StopsViewHolder(View itemView) {
            super(itemView);

            address = (TextView) itemView.findViewById(R.id.stop_address);
            distance = (TextView) itemView.findViewById(R.id.stop_distance);
        }

        public void bind(BusStopResult stop) {
            address.setText(stop.getBusStop().getAddress());
            distance.setText(String.valueOf(stop.getDistance()));
        }
    }

}

@@ -59,64 +59,120 @@
 ort 
-es.craftsmanship.toledo.katangapp.models.BusStopResult;%0A
+android.content.Context;%0Aimport android.graphics.Typeface;%0Aimport android.support.v7.widget.LinearLayoutManager;
 %0Aimp
@@ -211,25 +211,24 @@
 cyclerView;%0A
-%0A
 import andro
@@ -308,17 +308,16 @@
 wGroup;%0A
-%0A
 import a
@@ -365,16 +365,140 @@
 .List;%0A%0A
+import es.craftsmanship.toledo.katangapp.models.BusStopResult;%0Aimport es.craftsmanship.toledo.katangapp.utils.KatangaFont;%0A%0A
 /**%0A * @
@@ -656,16 +656,153 @@
  stops;%0A
+    private  Context context;%0A    private RecyclerView lineas;%0A    private  TextView address =null;%0A    private  TextView distance =null;
 %0A    pub
@@ -972,24 +972,62 @@
 viewType) %7B%0A
+        context= parent.getContext();%0A
         View
@@ -1247,24 +1247,110 @@
 position) %7B%0A
+        BusStopResult stop = new BusStopResult();%0A        stop = stops.get(position);%0A
         hold
@@ -1361,31 +1361,16 @@
 ind(stop
-s.get(position)
 );%0A    %7D
@@ -1525,88 +1525,43 @@
  %7B%0A%0A
- 
+%0A
        
-private final TextView address;%0A        private final TextView distance;
+LinesAdapter linesAdapter;%0A
 %0A%0A  
@@ -1800,184 +1800,741 @@
     
-%7D%0A%0A        public void bind(BusStopResult stop) %7B%0A            address.setText(stop.getBusStop().getAddress());%0A            distance.setText(String.valueOf(stop.getDistance()));
+    lineas = (RecyclerView) itemView.findViewById(R.id.lineas);%0A            lineas.setLayoutManager(new LinearLayoutManager(context));%0A%0A            Typeface tf = KatangaFont.getFont(context.getAssets(), KatangaFont.QUICKSAND_REGULAR);%0A%0A            address.setTypeface(tf);%0A            distance.setTypeface(tf);%0A%0A        %7D%0A%0A        public void bind(BusStopResult stop) %7B%0A%0A            int tam=  stop.getResults().size();%0A            lineas.setMinimumHeight(tam*100);%0A            lineas.setAdapter(new LinesAdapter(stop.getResults()));%0A            address.setText(stop.getBusStop().getAddress());%0A            String dtc= String.format(%22%25.2f%22, stop.getDistance());%0A            dtc=%22(%22+dtc+%22 metros)%22;%0A            distance.setText(dtc);%0A%0A
 %0A   

add lineas recyclerview adapter, setting heigh size of recyclerview