static void AddHeroImage(this MessageCell cell, int row, string imageUrl) { var index = cell.AddHeroImage(); //cell.HeroImageViews [index].SetCacheFormat (getCacheFormat (MessageCell.HeroScaledImageSize)); if (string.IsNullOrEmpty(imageUrl)) { cell.SetHeroImage(row, index, null); } else { var placeholder = getPlaceholderImage(MessageCell.HeroScaledImageSize); Glide.With(cell.Context).Load(imageUrl).Placeholder(placeholder).Into(cell.HeroImageViews [index]); //using (NSUrl url = new NSUrl (imageUrl)) //{ // cell?.HeroImageViews [index].SetImage (url, placeholder, (img) => cell.SetHeroImage (indexPath.Row, index, img), (err) => // { // cell.SetHeroImage (indexPath.Row, index, null); // Log.Debug (err.LocalizedDescription); // }); //} } }
public static ImageView GetHeroImageView(MessageCell cell) { var heroImageView = new ImageView(cell.Context) { }; heroImageView.LayoutParameters = cell.LayoutParameters; return(heroImageView); }
public static ImageView GetThumbnailImageView(MessageCell cell) { var thumbnailImageView = new ImageView(cell.Context) { }; thumbnailImageView.LayoutParameters = cell.LayoutParameters; return(thumbnailImageView); }
public static ImageView GetAvatarView(MessageCell cell) { var avatarView = new ImageView(cell.Context) { }; avatarView.LayoutParameters = cell.LayoutParameters; return(avatarView); }
public static LinearLayout GetContentStackView(MessageCell cell) { var stackView = new LinearLayout(cell.Context) { }; stackView.LayoutParameters = cell.LayoutParameters; return(stackView); }
public static TextView GetTimestampLabel(MessageCell cell) { var timestampLabel = new TextView(cell.Context) { }; timestampLabel.SetTextColor(Color.WhiteSmoke /*Color.LightGray*/); timestampLabel.LayoutParameters = cell.LayoutParameters; return(timestampLabel); }
public static TextView GetTitleLabel(MessageCell cell) { var titleLabel = new TextView(cell.Context) { }; titleLabel.SetTextColor(Color.White /*Colors.MessageColor*/); titleLabel.LayoutParameters = cell.LayoutParameters; return(titleLabel); }
public static TextView GetBodyLabel(MessageCell cell) { var bodyLabel = new TextView(cell.Context) { }; bodyLabel.SetTextColor(Color.White /*Colors.MessageColor*/); bodyLabel.SetLinkTextColor(Colors.MessageLinkColor); bodyLabel.LayoutParameters = cell.LayoutParameters; return(bodyLabel); }
public static TextView GetAttachmentSubtitleLabel(MessageCell cell) { var subTitleLabel = new TextView(cell.Context) { }; subTitleLabel.SetTextColor(Color.GhostWhite /*Color.DarkGray*/); subTitleLabel.SetLinkTextColor(Colors.MessageLinkColor); subTitleLabel.LayoutParameters = cell.LayoutParameters; return(subTitleLabel); }
public static Button GetButton(MessageCell cell, string title) { var button = new Button(cell.Context) { Text = title }; button.SetTextColor(Color.DarkGray); button.LayoutParameters = cell.LayoutParameters; return(button); }
static void SetHeader(this MessageCell cell, int row, BotMessage message) { cell.SetHeader(message.LocalTimeStamp, message.Activity?.From?.Name); //cell.ImageView.SetCacheFormat (getCacheFormat (MessageCell.AvatarImageSize)); //if (message.Activity.From.Id == "DigitalAgencies") //{ // cell.SetAvatar (row, UIImage.FromBundle ("avatar_microsoft")); //} //else //{ var avatarUrl = string.IsNullOrEmpty(message.Activity?.From?.Id) ? string.Empty : BotClient.Shared.GetAvatarUrl(message.Activity.From.Id); if (string.IsNullOrEmpty(avatarUrl)) { cell.SetAvatar(row, null); } else { var placeholder = getPlaceholderImage(MessageCell.AvatarImageSize); Glide.With(cell.Context).Load(avatarUrl).Placeholder(placeholder).Into(cell.AvatarView); //using (NSUrl url = new NSUrl (avatarUrl)) //{ // cell?.ImageView.SetImage (url, placeholder, (img) => cell.SetAvatar (indexPath.Row, img), (err) => // { // cell.SetAvatar (indexPath.Row, null); // Log.Debug (err.LocalizedDescription); // }); //} } //} }
public static void SetMessageCell(this List <BotMessage> messages, MessageCell cell, int row) { if (messages?.Count > 0 && messages.Count > row) { var message = messages [row]; //var cell = holder.ItemView as MessageCell; cell.Key = row; if (message.Head) { cell.SetHeader(row, message); } if (message.HasText) { cell.SetMessage(message.AttributedText); } if (message.HasAtachments) { foreach (var attachment in message.Attachments) { // images if (attachment.Content.HasImages) { foreach (var image in attachment.Content.Images) { cell.AddHeroImage(row, image.Url); } } // title if (attachment.Content.HasTitle) { cell.AddAttachmentTitle(attachment.Content.AttributedTitle); } // subtitle if (attachment.Content.HasSubtitle) { cell.AddAttachmentSubtitle(attachment.Content.AttributedSubtitle); } // text if (attachment.Content.HasText) { cell.AddAttachmentText(attachment.Content.AttributedText); } // buttons if (attachment.Content.HasButtons) { cell.SetButtons(attachment.Content.Buttons.Select(b => (b.Title, b.Value.ToString())).ToArray()); } } } // Cells must inherit the table view's transform // This is very important, since the main table view may be inverted //cell.Transform = tableView.Transform; //return cell; } //return null; }
public MessageCellViewHolder(MessageCell itemView) : base(itemView) { }