package es.craftsmanship.toledo.katangapp.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.squareup.otto.Bus;

import java.io.Serializable;
import java.util.List;

import es.craftsmanship.toledo.katangapp.activities.R;
import es.craftsmanship.toledo.katangapp.models.BusStop;


public class RouteFragment extends Fragment {

        private static final String ARG_SECTION_NUMBER = "section_number";
        private static final String ARG_LINE_NUMBER = "line_number";

        public RouteFragment() {
        }

        /**
         * Returns a new instance of this fragment for the given section
         * number.
         */
        public static RouteFragment newInstance(List<BusStop> linea) {
            RouteFragment fragment = new RouteFragment();
            Bundle args = new Bundle();
            args.putSerializable(ARG_LINE_NUMBER, (Serializable) linea);
            fragment.setArguments(args);
            return fragment;
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_route, container, false);

         /* List<BusStop>  ruta= (List<BusStop>) getArguments().getSerializable(ARG_LINE_NUMBER);
            for(BusStop stop: ruta){
                stop.getAddress();
                stop.getId();
                stop.getRouteId();
            }
            TextView textView = (TextView) rootView.findViewById(R.id.section_label);
            TextView textViewRuta = (TextView) rootView.findViewById(R.id.section_ruta);


            textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
            textViewRuta.setText(getArguments().getString(ARG_LINE_NUMBER));*/
            return rootView;
        }
    }


@@ -47,16 +47,253 @@
 ments;%0A%0A
+import es.craftsmanship.toledo.katangapp.activities.R;%0Aimport es.craftsmanship.toledo.katangapp.adapters.LineBusStopAdapter;%0Aimport es.craftsmanship.toledo.katangapp.models.BusStop;%0Aimport es.craftsmanship.toledo.katangapp.models.Route;%0A
 %0Aimport 
@@ -307,24 +307,25 @@
 .os.Bundle;%0A
+%0A
 import andro
@@ -352,16 +352,118 @@
 agment;%0A
+import android.support.v7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView;%0A%0A
 import a
@@ -552,39 +552,8 @@
 p;%0A%0A
-import com.squareup.otto.Bus;%0A%0A
 impo
@@ -605,119 +605,8 @@
 t;%0A%0A
-import es.craftsmanship.toledo.katangapp.activities.R;%0Aimport es.craftsmanship.toledo.katangapp.models.BusStop;
 %0A%0A%0Ap
@@ -687,31 +687,28 @@
  String ARG_
-SECTION
+LINE
 _NUMBER = %22s
@@ -706,23 +706,20 @@
 MBER = %22
-section
+line
 _number%22
@@ -740,219 +740,178 @@
 ate 
-static final String ARG_LINE_NUMBER = %22line_number%22;%0A%0A        public RouteFragment() %7B%0A        %7D%0A%0A        /**%0A         * Returns a new instance of this fragment for the given section%0A         * number.%0A 
+RecyclerView mRecyclerView;%0A        private RecyclerView.LayoutManager mLayoutManager;%0A        private List%3CBusStop%3E lineStops;%0A%0A        public RouteFragment() %7B%0A
         
 */%0A 
@@ -906,18 +906,19 @@
         
-*/
+%7D%0A%0A
 %0A       
@@ -958,34 +958,25 @@
 nstance(
-List%3CBusStop%3E line
+Route rut
 a) %7B%0A   
@@ -1135,20 +1135,19 @@
 izable) 
-line
+rut
 a);%0A    
@@ -1378,24 +1378,25 @@
 nceState) %7B%0A
+%0A
             
@@ -1472,25 +1472,28 @@
 false);%0A
-%0A
+    
         
  /* List
@@ -1488,231 +1488,230 @@
     
- /* List%3CBusStop%3E  ruta= (List%3CBusStop%3E) getArguments().getSerializable(ARG_LINE_NUMBER);%0A            for(BusStop stop: ruta)%7B%0A                stop.getAddress();%0A                stop.getId();%0A                stop.getRouteId
+mRecyclerView = (RecyclerView) rootView.findViewById(R.id.line_stops);%0A            Route  ruta= (Route) getArguments().getSerializable(ARG_LINE_NUMBER);%0A            if(ruta!=null)%7B%0A              lineStops= ruta.getBusStops
 ();%0A
@@ -1720,24 +1720,25 @@
           %7D%0A
+%0A
             
@@ -1741,173 +1741,125 @@
     
-TextView textView = (TextView) rootView.findViewById(R.id.section_label);%0A            TextView textViewRuta = (TextView) rootView.findViewById(R.id.section_ruta
+mLayoutManager = new LinearLayoutManager(getActivity());%0A            mRecyclerView.setLayoutManager(mLayoutManager
 );%0A
-%0A%0A
     
@@ -1870,183 +1870,69 @@
     
-textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));%0A            textViewRuta.setText(getArguments().getString(ARG_LINE_NUMBER));*/
+mRecyclerView.setAdapter(new LineBusStopAdapter(lineStops));%0A
 %0A   
@@ -1953,24 +1953,25 @@
 n rootView;%0A
+%0A
         %7D%0A  

add Route Fragment