4 |
import java.util.List; |
import java.util.List; |
5 |
|
|
6 |
import android.content.Context; |
import android.content.Context; |
|
import android.util.Log; |
|
7 |
import android.view.LayoutInflater; |
import android.view.LayoutInflater; |
8 |
import android.view.View; |
import android.view.View; |
9 |
import android.view.ViewGroup; |
import android.view.ViewGroup; |
57 |
public View getView(int position, View convertView, ViewGroup parent) { |
public View getView(int position, View convertView, ViewGroup parent) { |
58 |
StationBean station = stations.get(position); |
StationBean station = stations.get(position); |
59 |
|
|
60 |
View root; |
View root = inflater.inflate(R.layout.stationrow , parent, false); |
|
if (convertView == null || convertView.getId() != R.id.StationRow) { |
|
|
root = inflater.inflate(R.layout.stationrow , parent, false); |
|
|
} else { |
|
|
root = convertView; |
|
|
} |
|
|
|
|
61 |
TextView tview = (TextView) root.findViewById(R.id.stationName); |
TextView tview = (TextView) root.findViewById(R.id.stationName); |
62 |
tview.setText(station.getName()); |
tview.setText(station.getName()); |
63 |
|
|
64 |
tview = (TextView) root.findViewById(R.id.stationDistance); |
tview = (TextView) root.findViewById(R.id.stationDistance); |
65 |
tview.setText("Distance: " + number.format( (double)station.getDistance()/1000.0) + " km."); |
tview.setText("Distance: " + number.format( (double)station.getDistance()/1000.0) + " km."); |
66 |
|
|
67 |
|
root.findViewById(R.id.isregional).setVisibility( station.isRegional() ? View.VISIBLE : View.INVISIBLE ); |
68 |
|
root.findViewById(R.id.isstrain).setVisibility( station.isSTrain() ? View.VISIBLE : View.INVISIBLE ); |
69 |
|
root.findViewById(R.id.ismetro).setVisibility( station.isMetro() ? View.VISIBLE : View.INVISIBLE ); |
70 |
|
|
71 |
return root; |
return root; |
72 |
} |
} |
73 |
} |
} |