--- android/TrainInfo/src/dk/thoerup/traininfo/TimetableListAdapter.java 2009/09/30 06:02:03 364 +++ android/TrainInfo/src/dk/thoerup/traininfo/TimetableListAdapter.java 2009/09/30 09:14:27 365 @@ -3,10 +3,12 @@ import java.util.List; import android.content.Context; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; +import android.widget.TextView; public class TimetableListAdapter extends BaseAdapter { @@ -46,8 +48,33 @@ @Override public View getView(int position, View convertView, ViewGroup parent) { - // TODO Auto-generated method stub - return null; + TimetableBean timetableBean = timetable.get(position); + + View root = inflater.inflate(R.layout.timetablerow , parent, false); + + TextView station = (TextView) root.findViewById(R.id.Station); + station.setText(timetableBean.getStation()); + + TextView arrival = (TextView) root.findViewById(R.id.Arrival); + arrival.setText(timetableBean.getArrival()); + + TextView departure = (TextView) root.findViewById(R.id.Departure); + departure.setText(timetableBean.getDeparture()); + + + if (timetableBean.isCurrent()) { + final int bgcolor = 0xFFFFFFFF; + final int fgcolor = 0xFF000000; + + station.setTextColor(fgcolor); + arrival.setTextColor(fgcolor); + departure.setTextColor(fgcolor); + root.setBackgroundColor(bgcolor); + + Log.e("Current","current"); + } + + return root; } }