Search in sources :

Example 1 with Trip

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;
}
Also used : Trip(com.example.androidforios.app.data.model.Trip) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 Trip (com.example.androidforios.app.data.model.Trip)1