use of com.example.androidforios.app.data.model.Trip in project AndroidForiOS by smbarne.
the class TripArrayAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Trip trip = this.getItem(position);
View inflatedView = convertView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflatedView = inflater.inflate(LAYOUT_RESOURCE_ID, parent, false);
}
TextView destinationTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_left_text_view);
TextView timeStampTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_middle_text_view);
TextView trainNameTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_right_text_view);
destinationTextView.setText(trip.destination);
if (trip.positionTimeStamp != null) {
timeStampTextView.setText(DateFormat.getDateTimeInstance().format(trip.positionTimeStamp));
timeStampTextView.setVisibility(View.VISIBLE);
} else {
timeStampTextView.setVisibility(View.GONE);
}
trainNameTextView.setText(trip.trainName);
return inflatedView;
}
Aggregations