private void ToggleCheckedIcon(LastChatAdapterViewHolder holder, int position) { try { if (SelectedItems.Get(position, false)) { holder.LytImage.Visibility = ViewStates.Gone; holder.LytChecked.Visibility = ViewStates.Visible; if (CurrentSelectedIdx == position) { ResetCurrentItems(); } } else { holder.LytChecked.Visibility = ViewStates.Gone; holder.LytImage.Visibility = ViewStates.Visible; if (CurrentSelectedIdx == position) { ResetCurrentItems(); } } } catch (Exception e) { Console.WriteLine(e); } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { try { //Setup your layout here >> Style_HContact_view var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_LastChat_view, parent, false); var vh = new LastChatAdapterViewHolder(itemView, OnClick, OnLongClick); return(vh); } catch (Exception exception) { Console.WriteLine(exception); return(null); } }
public void Initialize(LastChatAdapterViewHolder holder, GetChatsObject.Data item) { try { GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.ImageAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); string name = Methods.FunString.DecodeString(item.UserData.Name); if (holder.TxtUsername.Text != name) { holder.TxtUsername.Text = name; } string lastMessage = Methods.FunString.DecodeString(item.LastMessage); if (holder.TxtLastMessages.Text != lastMessage) { holder.TxtLastMessages.Text = lastMessage; } //last seen time holder.TxtTimestamp.Text = Methods.Time.ReplaceTime(item.TimeText); if (item.NewMessage <= 0) { holder.ImageColor.Visibility = ViewStates.Invisible; } else { var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(25).EndConfig().BuildRound(item.NewMessage.ToString(), Color.ParseColor(AppSettings.MainColor)); holder.ImageColor.SetImageDrawable(drawable); holder.ImageColor.Visibility = ViewStates.Visible; } } catch (Exception e) { Console.WriteLine(e); } }