Esempio n. 1
0
 private void setUpMessageItem(final MessageViewHolder viewHolder, final int i) {
   final Message message = messages.get(i);
   viewHolder.userpic.setImageDrawable(null);
   final User user = findUserById(message.getFrom());
   if (user != null) {
     Glide.with(context).load(user.getImgLink()).into(viewHolder.userpic);
     viewHolder.username.setText(user.getName());
   }
   viewHolder.message.setText(message.getText());
 }
Esempio n. 2
0
  private void setUpUsersItem(final MessageViewHolder viewHolder, final int position) {
    for (int i = 0; i < users.size(); i++) {
      final User user = users.get(i);

      final LinearLayout column = i % 2 == 0 ? viewHolder.leftColumn : viewHolder.rightColumn;

      final View userView = LayoutInflater.from(context).inflate(R.layout.view_user, column, false);

      Glide.with(context)
          .load(user.getImgLink())
          .into((ImageView) userView.findViewById(R.id.userpic));
      ((TextView) userView.findViewById(R.id.username)).setText(user.getName());

      userView.setContentDescription(String.valueOf(i));
      userView.setOnClickListener(listener);
      column.addView(userView);
    }
  }
Esempio n. 3
0
 private User findUserById(final String from) {
   for (User user : users) if (user.getId().equals(from)) return user;
   return null;
 }