private View GetMessageTemplateDelegate(int i, MalMessageModel malMessageModel, View arg3) { var view = arg3; if (view == null || !view.Tag.Unwrap <MalMessageModel>().Sender.Equals(malMessageModel.Sender, StringComparison.InvariantCultureIgnoreCase)) { view = Activity.LayoutInflater.Inflate( malMessageModel.Sender.Equals(Credentials.UserName, StringComparison.InvariantCultureIgnoreCase) ? Resource.Layout.MessagingDetailsPageItemMine : Resource.Layout.MessagingDetailsPageItemOther, null); } view.Tag = malMessageModel.Wrap(); view.FindViewById <TextView>(Resource.Id.MessagingDetailsPageItemContent).Text = malMessageModel.Content; view.FindViewById <TextView>(Resource.Id.MessagingDetailsPageItemDate).Text = malMessageModel.Date; if (malMessageModel.Images.Any()) { var img = view.FindViewById <ImageViewAsync>(Resource.Id.MessagingDetailsPageItemImage); img.Visibility = ViewStates.Invisible; img.Into(malMessageModel.Images.First()); } else { view.FindViewById <ImageViewAsync>(Resource.Id.MessagingDetailsPageItemImage).Visibility = ViewStates.Gone; } return(view); }
private View GetMessageTemplateDelegate(int i, MalMessageModel malMessageModel, View convertView) { var view = convertView; if (view == null) { view = Activity.LayoutInflater.Inflate(Resource.Layout.MessagingPageItem, null); view.Click += MessageOnClick; } view.Tag = malMessageModel.Wrap(); view.FindViewById <TextView>(Resource.Id.MessagingPageItemSender).Text = malMessageModel.Sender; view.FindViewById <TextView>(Resource.Id.MessagingPageItemDate).Text = malMessageModel.Date; view.FindViewById <TextView>(Resource.Id.MessagingPageItemContent).Text = malMessageModel.Content; view.FindViewById <TextView>(Resource.Id.MessagingPageItemTitle).Text = malMessageModel.Subject; var stateImg = view.FindViewById <ImageView>(Resource.Id.MessagingPageItemStateSymbol); if (malMessageModel.IsRead) { stateImg.SetImageResource(Resource.Drawable.icon_message_read); stateImg.ImageTintList = ColorStateList.ValueOf(new Color(ResourceExtension.BrushText)); } else { if (malMessageModel.IsMine) { stateImg.SetImageResource(Resource.Drawable.icon_message_sent); stateImg.ImageTintList = ColorStateList.ValueOf(new Color(ResourceExtension.BrushText)); } else { stateImg.SetImageResource(Resource.Drawable.icon_message_alert); stateImg.ImageTintList = ColorStateList.ValueOf(new Color(ResourceExtension.AccentColourDark)); } } return(view); }