// For the date attribute header public override NSAttributedString GetMessageBubbleTopLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { var index = (int)indexPath.Item; var message = messages[index]; return(MessagesTimestampFormatter.SharedFormatter.GetAttributedTimestamp(message.Date)); }
public override IMessageBubbleImageDataSource GetMessageBubbleImageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages [indexPath.Row]; if (message.SenderId == SenderId) return outgoingBubbleImageData; return incomingBubbleImageData; }
public override IMessageAvatarImageDataSource GetAvatarImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { if (messages[indexPath.Row].SenderId.Equals(CHATTER_ID)) { return(MessagesAvatarImageFactory.CreateAvatarImage(UIImage.FromBundle("friend"), 25)); } ; return(null); }
public override IMessageAvatarImageDataSource GetAvatarImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = _messages[indexPath.Row]; if (message.SenderId == SenderId) { return(_incomingAvatar); } return(_outgoingAvatar); }
public override IMessageBubbleImageDataSource GetMessageBubbleImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages[indexPath.Row]; if (message.SenderId.Equals(SenderId)) { return(outgoingBubbleImageData); } return(incomingBubbleImageData); }
public override IMessageBubbleImageDataSource GetMessageBubbleImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages[indexPath.Row]; if (message.SenderId == AppSettingsManager.ClientId) { return(outgoingBubbleImageData); } return(incomingBubbleImageData); }
public override NSAttributedString GetMessageBubbleTopLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { var timestampAttributes = new UIStringAttributes { ForegroundColor = Theme.Current.IncomingTextColor, BackgroundColor = UIColor.White, Font = Theme.Current.MessageFont }; MessageViewModel message = viewModel.Messages [indexPath.Row]; var timestamp = new NSAttributedString(message.Timestamp.ToString("MMM d, hh:mm tt"), timestampAttributes); return(timestamp); }
public override NSAttributedString GetMessageBubbleTopLabelAttributedText (MessagesCollectionView collectionView, NSIndexPath indexPath) { var timestampAttributes = new UIStringAttributes { ForegroundColor = Theme.Current.IncomingTextColor, BackgroundColor = UIColor.White, Font = Theme.Current.MessageFont }; MessageViewModel message = viewModel.Messages [indexPath.Row]; var timestamp = new NSAttributedString (message.Timestamp.ToString("MMM d, hh:mm tt"), timestampAttributes); return timestamp; }
public override NSAttributedString GetMessageBubbleTopLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { switch (messages[indexPath.Row].SenderId) { //case JAYENDRA_ID: // return new NSAttributedString(JAYENDRA); //case ROHIT_ID: //return new NSAttributedString(ROHIT); default: return(null); } }
public override NSAttributedString GetCellBottomLabelAttributedText (MessagesCollectionView collectionView, NSIndexPath indexPath) { MessageViewModel message = viewModel.Messages [indexPath.Row]; if (!message.IsIncoming) { var messageStatusAttributes = new UIStringAttributes { ForegroundColor = Theme.Current.IncomingTextColor, BackgroundColor = UIColor.White, Font = Theme.Current.MessageFont }; var messageStatus = new NSAttributedString (GetMessageStatus(message), messageStatusAttributes); return messageStatus; } return null; }
public override NSAttributedString GetCellBottomLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { MessageViewModel message = viewModel.Messages [indexPath.Row]; if (!message.IsIncoming) { var messageStatusAttributes = new UIStringAttributes { ForegroundColor = Theme.Current.IncomingTextColor, BackgroundColor = UIColor.White, Font = Theme.Current.MessageFont }; var messageStatus = new NSAttributedString(GetMessageStatus(message), messageStatusAttributes); return(messageStatus); } return(null); }
public override IMessageData GetMessageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { MessageViewModel msg = viewModel.Messages [indexPath.Row]; TextMessageViewModel msgAsText = msg as TextMessageViewModel; ImageMessageViewModel msgAsImage = msg as ImageMessageViewModel; string senderId = msg.IsIncoming ? viewModel.Friend.FriendId.ToString() : SenderId; string senderName = msg.IsIncoming ? viewModel.Friend.Name : SenderDisplayName; if (string.IsNullOrWhiteSpace(senderName)) { senderName = string.Empty; } NSDate msgDate = (NSDate)(new DateTime(msg.Timestamp.Ticks, DateTimeKind.Utc)); var result = new JSQMessagesViewController.Message(senderId, senderName, msgDate, msgAsImage != null ? "Image message" : msgAsText.Text); return(result); }
public override NSAttributedString GetCellBottomLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { MessageViewModel message = viewModel.Messages [indexPath.Row]; bool isLastMessage = viewModel.Messages.Count > 0 && indexPath.Row == viewModel.Messages.Count - 1; if (!message.IsIncoming && (isLastMessage || message.Status != MessageStatus.Seen)) { var messageStatusAttributes = new UIStringAttributes { ForegroundColor = Theme.Current.IncomingTextColor, BackgroundColor = UIColor.Clear, Font = Theme.Current.MessageFont }; var messageStatus = new NSAttributedString(GetMessageStatus(message), messageStatusAttributes); return(messageStatus); } return(null); }
public override NSAttributedString GetMessageBubbleTopLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages [indexPath.Row]; Console.WriteLine(message.SenderDisplayName); if (message.SenderId == SenderId) { return(new NSAttributedString(message.SenderDisplayName)); } if (indexPath.Length - 1 > 1) { var previousMessage = messages [indexPath.Row - 1]; if (previousMessage.SenderId == SenderId) { return(null); } } return(new NSAttributedString(message.SenderDisplayName)); }
public override IMessageAvatarImageDataSource GetAvatarImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { UIImage image = null; var index = (int)indexPath.Item; if (messages[index].SenderId == AppSettingsManager.ClientId) { image = GravatarManager.GetImage(GravatarUser.Customer); } else { image = GravatarManager.GetImage(GravatarUser.Agent); } // Default is (34, 34) for diameter if (image != null) { return(MessagesAvatarImageFactory.CreateAvatarImage(image, 34)); } return(null); }
protected override void OnAppearing() { MessagingCenter.Subscribe <MessagerPageViewModel, MyFocusEventArgs>(this, Constants.ShowKeyboard, (s, args) => IsFocusOnKeyBoardChanged(args.IsFocused)); MessagingCenter.Subscribe <MessagerPageViewModel, ScrollToItemEventArgs>(this, Constants.ScrollToItem, (s, eargs) => { MessagesCollectionView.ScrollTo(eargs.Item); }); MessagingCenter.Subscribe <object, KeyboardAppearEventArgs>(this, Constants.iOSKeyboardAppears, (sender, eargs) => { if (MessagesGrid.TranslationY == 0) { MessagesGrid.TranslationY -= eargs.KeyboardSize; } }); MessagingCenter.Subscribe <object, string>(this, Constants.iOSKeyboardDisappears, (sender, eargs) => { MessagesGrid.TranslationY = 0; }); base.OnAppearing(); }
/// <summary> /// Gets the message data. /// </summary> /// <returns>The message data.</returns> /// <param name="collectionView">Collection view.</param> /// <param name="indexPath">Index path.</param> public override IMessageData GetMessageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages [indexPath.Row]; var msg = new Message (message.sender, ContactosTableSource.cellIdentifier, NSDate.Now, message.content); return msg; }
public override IMessageBubbleImageDataSource GetMessageBubbleImageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = ViewModel.Messages [indexPath.Row]; if(!message.IsIncoming) return outgoingBubbleImageData; return incomingBubbleImageData; }
public override IMessageAvatarImageDataSource GetAvatarImageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = ViewModel.Messages [indexPath.Row]; if (!message.IsIncoming) return MessagesAvatarImageFactory.CreateAvatarImage (UIImage.FromBundle ("default_user"), 30); else return MessagesAvatarImageFactory.CreateAvatarImage (UIImage.FromBundle ("default_watson"), 30); }
public override IMessageData GetMessageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { return(_messages[indexPath.Row]); }
public override IMessageData GetMessageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = ViewModel.Messages [indexPath.Row]; var senderId = (message.IsIncoming) ? "watson" : "user"; return JSQMessagesViewController.Message.Create (senderId, senderId, message.Text); }
public override IMessageAvatarImageDataSource GetAvatarImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages[indexPath.Row]; return(incomingAvatar); }
// For the date attribute header public override nfloat GetMessageBubbleTopLabelHeight(MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath) { // Return the date on every 4th cell return(indexPath.Item % 4 == 0 ? 20f : 0f); }
public override void TappedMessageBubble(MessagesCollectionView collectionView, NSIndexPath indexPath) { }
public override IMessageAvatarImageDataSource GetAvatarImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { return(null); }
//public override nfloat GetMessageBubbleTopLabelHeight(MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath) //{ // return 25.0f; //} public override NSAttributedString GetCellBottomLabelAttributedText(MessagesCollectionView collectionView, NSIndexPath indexPath) { return(new NSAttributedString(DateTime.Now.ToString("MMM d h:mm"))); }
public override nfloat GetCellBottomLabelHeight(MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath) { return(25.0f); }
public override nfloat GetMessageBubbleTopLabelHeight (MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath) { return 20.0f; }
public override NSAttributedString GetMessageBubbleTopLabelAttributedText (MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = messages [indexPath.Row]; Console.WriteLine (message.SenderDisplayName); if (message.SenderId == SenderId) { return new NSAttributedString (message.SenderDisplayName); } if (indexPath.Length -1 > 1) { var previousMessage = messages [indexPath.Row-1]; if (previousMessage.SenderId == SenderId) { return null; } } return new NSAttributedString (message.SenderDisplayName); }
public override IMessageBubbleImageDataSource GetMessageBubbleImageData(MessagesCollectionView collectionView, NSIndexPath indexPath) { var message = viewModel.Messages [indexPath.Row]; return(message.IsIncoming ? incomingBubbleImageData : outgoingBubbleImageData); }
//We are not using this feature, so we set it to null. public override IMessageAvatarImageDataSource GetAvatarImageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { return null; }
public override IMessageData GetMessageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { return messages [indexPath.Row]; }
public override IMessageData GetMessageData (MessagesCollectionView collectionView, NSIndexPath indexPath) { MessageViewModel msg = viewModel.Messages [indexPath.Row]; TextMessageViewModel msgAsText = msg as TextMessageViewModel; ImageMessageViewModel msgAsImage = msg as ImageMessageViewModel; string senderId = msg.IsIncoming ? viewModel.Friend.FriendId.ToString () : SenderId; string senderName = msg.IsIncoming ? viewModel.Friend.Name : SenderDisplayName; if (string.IsNullOrWhiteSpace (senderName)) senderName = string.Empty; NSDate msgDate = (NSDate)(new DateTime (msg.Timestamp.Ticks, DateTimeKind.Utc)); var result = new JSQMessagesViewController.Message (senderId, senderName, msgDate, msgAsImage != null ? "Image message" : msgAsText.Text); return result; }
public override nfloat GetMessageBubbleTopLabelHeight(MessagesCollectionView collectionView, MessagesCollectionViewFlowLayout collectionViewLayout, NSIndexPath indexPath) { return(20.0f); }