use of chat.rocket.android.renderer.UserRenderer in project Rocket.Chat.Android by RocketChat.
the class RoomUserAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RoomUserViewHolder holder, int position) {
String username = usernames.get(position);
if (TextUtils.isEmpty(username)) {
return;
}
RealmUser realmUser = realmHelper.executeTransactionForRead(realm -> realm.where(RealmUser.class).equalTo(RealmUser.USERNAME, username).findFirst());
if (realmUser == null) {
User user = User.builder().setId("some-local-is").setUsername(username).setUtcOffset(0).build();
new UserRenderer(context, user).avatarInto(holder.avatar, absoluteUrl).usernameInto(holder.username);
} else {
new UserRenderer(context, realmUser.asUser()).statusColorInto(holder.status).avatarInto(holder.avatar, absoluteUrl).usernameInto(holder.username);
}
}
Aggregations