public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ConversationItemRovView, parent, false); ConversationViewHolder vh = new ConversationViewHolder(itemView, OnConversationItemClick); return(vh); }
public override async void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var currentItem = this.ConversationItems[position]; ConversationViewHolder vh = holder as ConversationViewHolder; vh.InterlocutorNameTextView.Text = currentItem.InterlocutorName; vh.LastMessageTextView.Text = currentItem.LastMessage; vh.LastMessageDateTextView.Text = currentItem.LastMessageDate; if (currentItem.InterLocutorProfileImage != null) { vh.InterlocutorProfileImage.SetImageBitmap(await this.bitmapService.GetScaledDownBitmapForDisplayAsync(currentItem.InterLocutorProfileImage)); } else { vh.InterlocutorProfileImage.SetImageResource(Resource.Drawable.logo_user); } vh.LastMessageDateTextView.Text = currentItem.LastMessageDate; RaiseOnInfiniteScrollWhenItemIsLastInList(currentItem, vh); }
private void RaiseOnInfiniteScrollWhenItemIsLastInList(ConversationItemModel currentItem, ConversationViewHolder viewHolder) { if (this.ConversationItems.IndexOf(currentItem) == (this.ConversationItems.Count - 1) && !InfiniteScrollDisabled) { this.infiniteScrollListener.OnInfiniteScroll(); } }