use of de.bahnhoefe.deutschlands.bahnhofsfotos.databinding.ItemInboxBinding in project RSAndroidApp by RailwayStations.
the class InboxAdapter method getView.
@Override
@NonNull
public View getView(final int position, final View convertView, @NonNull final ViewGroup parent) {
var rowView = convertView;
// reuse views
final ItemInboxBinding binding;
if (rowView == null) {
binding = ItemInboxBinding.inflate(context.getLayoutInflater(), parent, false);
rowView = binding.getRoot();
rowView.setTag(binding);
} else {
binding = (ItemInboxBinding) rowView.getTag();
}
// fill data
final var item = publicInboxes.get(position);
binding.txtStationName.setText(item.getTitle());
if (item.getStationId() != null) {
binding.txtStationId.setText(item.getCountryCode().concat(":").concat(item.getStationId()));
} else {
binding.txtStationId.setText(R.string.missing_station);
}
binding.txtCoordinates.setText(String.valueOf(item.getLat()).concat(",").concat(String.valueOf(item.getLon())));
return rowView;
}
Aggregations