Пример #1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      if (convertView == null) {
        convertView = getLayoutInflater().inflate(R.layout.item_with_icon, parent, false);
      }

      OrganizationInEvent event = orgInEvents[position];
      boolean registered = registeredEventIds.contains(event.getEventId());

      FindView.textView(convertView, R.id.title).setText(event.getName());
      FindView.textView(convertView, R.id.short_description).setText(event.getDescription());
      if (registered) {
        FindView.imageView(convertView, R.id.icon).setImageResource(R.drawable.ic_registered);
      } else {
        FindView.imageView(convertView, R.id.icon)
            .setImageResource(
                event.registrationPossible()
                    ? R.drawable.ic_not_registered
                    : R.drawable.ic_registration_closed);
      }

      return convertView;
    }
Пример #2
0
 private UserInEvent findUserInEvent(OrganizationInEvent event) {
   for (UserInEvent userInEvent : userInEvents) {
     if (userInEvent.getEventId().equals(event.getEventId())) return userInEvent;
   }
   throw new IllegalStateException("No such userInEvent " + event);
 }