public void Configure(Core.Models.ProfileDivisionDetails division, EventHandler <int> divisionEvent) { _division = division; _divisionEvent = divisionEvent; _imageView.Image?.Dispose(); if (_division.AddButtonImage) { _imageView.Image = UIImage.FromBundle("add_circle"); _label.Hidden = true; } else { if (!string.IsNullOrEmpty(_division.Picture)) { ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _division.Picture)); }).ErrorPlaceholder("division_noimage", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_imageView); } else { CustomUIExtensions.RoundView(_imageView); _imageView.Image = UIImage.FromBundle("division_noimage"); } _label.Hidden = false; UILabelExtensions.SetupLabelAppearance(_label, _division.Name, Colors.ProfileGray, 13f); } _button.TouchUpInside -= OnButton_TouchUpInside; _button.TouchUpInside += OnButton_TouchUpInside; }
private void StartCall() { _speakerIcon.Hidden = false; _muteIcon.Hidden = false; _speakerIcon.Image = ViewModel.SpeakerOn ? UIImage.FromBundle("speaker_on") : UIImage.FromBundle("speaker_off"); _muteIcon.Image = ViewModel.MutedOn ? UIImage.FromBundle("micro_off") : UIImage.FromBundle("micro_on"); _speakerBackgroundImage.Image = new UIImage(); _muteBackgroundImage.Image = new UIImage(); _speakerBackgroundImage.BackgroundColor = Colors.White.ColorWithAlpha(0.3f); _muteBackgroundImage.BackgroundColor = Colors.White.ColorWithAlpha(0.3f); CustomUIExtensions.RoundView(_speakerBackgroundImage); CustomUIExtensions.RoundView(_muteBackgroundImage); UILabelExtensions.SetupLabelAppearance(_speakerLabel, ViewModel.SpeakerLabel, Colors.White, 12f); UILabelExtensions.SetupLabelAppearance(_muteLabel, ViewModel.MuteLabel, Colors.White, 12f); AgoraDelegate = new AgoraRtcDelegate(this); CallProvider.SetupAgoraIO(this, ViewModel.RoomName, ViewModel.SpeakerOn, ViewModel.MutedOn, ViewModel.StartedCall); _activeCall = ViewModel.StartedCall ? CallProvider.CallManager.StartCall(ViewModel.MemberFullName, ViewModel.CallerId) : CallProvider.CallManager.Calls.LastOrDefault(); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.UserInteractionEnabled = true; CustomUIExtensions.ViewShadowForChatPupUp(_backgroundView); _pictureImage.Image?.Dispose(); if (!string.IsNullOrEmpty(_picture)) { _pictureCopy = string.Copy(_picture); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_pictureImage); } else { _pictureImage.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_pictureImage); } UILabelExtensions.SetupLabelAppearance(_nameLabel, _name, Colors.Black, 13f, UIFontWeight.Semibold); UILabelExtensions.SetupLabelAppearance(_descriptionLabel, _message, Colors.Black, 12f, UIFontWeight.Regular); _openChatButton.TouchUpInside -= OnOpenChatButton_TouchUpInside; _openChatButton.TouchUpInside += OnOpenChatButton_TouchUpInside; Xamarin.Essentials.Vibration.Vibrate(TimeSpan.FromMilliseconds(500)); gesture.AddTarget(() => HandleDrag(gesture)); this.View.AddGestureRecognizer(gesture); }
public void Configure(CallHistoryModel call, EventHandler <int> openProfile) { _callerId = call.CallerId; _openProfile = openProfile; var nameAttr = new UIStringAttributes { ForegroundColor = Colors.ProfileGray, Font = UIFont.SystemFontOfSize(14, call.ShouldAlert ? UIFontWeight.Bold : UIFontWeight.Medium) }; var RoleAttr = new UIStringAttributes { ForegroundColor = Colors.Black, Font = UIFont.SystemFontOfSize(14, call.ShouldAlert ? UIFontWeight.Semibold : UIFontWeight.Regular) }; var letterCount = call.CallerInfo.IndexOf("-") + 1; var customString = new NSMutableAttributedString(call.CallerInfo); customString.SetAttributes(nameAttr.Dictionary, new NSRange(0, letterCount)); customString.SetAttributes(RoleAttr.Dictionary, new NSRange(letterCount + 1, call.CallerInfo.Length - (letterCount + 1))); // assign the styled text _callerInfoLabel.AttributedText = customString; UILabelExtensions.SetupLabelAppearance(_dateLabel, call.CallDateText, Colors.ProfileGray, 13f, call.ShouldAlert ? UIFontWeight.Semibold : UIFontWeight.Regular); UILabelExtensions.SetupLabelAppearance(_callingTypeLabel, call.CallCountAndType, call.HasSuccess ? Colors.Green : Colors.Red, 13f, call.ShouldAlert ? UIFontWeight.Semibold : UIFontWeight.Regular); _imageView.Image?.Dispose(); if (!string.IsNullOrEmpty(call.CallerPicture)) { _picture = string.Copy(call.CallerPicture); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_imageView); } else { _imageView.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_imageView); } _openProfileButton.TouchUpInside -= OnOpenProfileButton_TouchUpInside; _openProfileButton.TouchUpInside += OnOpenProfileButton_TouchUpInside; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.Alpha = 0.3f; this.View.BackgroundColor = Colors.Black30; _backgroundView.Layer.CornerRadius = 2f; _buttonView.Layer.CornerRadius = 2f; CustomUIExtensions.ViewShadow(_backgroundView); UILabelExtensions.SetupLabelAppearance(_titleLabel, _title, Colors.Black, 24f, UIFontWeight.Medium); UILabelExtensions.SetupLabelAppearance(_label1, _text1, Colors.GrayLabel, 14f); UILabelExtensions.SetupLabelAppearance(_label2, _text2, Colors.GrayLabel, 14f); UILabelExtensions.SetupLabelAppearance(_label3, _text3, Colors.GrayLabel, 14f); CustomUIExtensions.RoundView(_dotview1); CustomUIExtensions.RoundView(_dotview2); CustomUIExtensions.RoundView(_dotview3); if (string.IsNullOrEmpty(_text2)) { _dotview2.Hidden = true; _label2.Hidden = true; } if (string.IsNullOrEmpty(_text3)) { _dotview3.Hidden = true; _label3.Hidden = true; } UIButtonExtensions.SetupButtonAppearance(_submitButton, Colors.White, 17f, _confirmButtonText); _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal); _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit; _closeButton.TintColor = Colors.Black; _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside; _closeButton.TouchUpInside += OnCloseButton_TouchUpInside; _submitButton.TouchUpInside -= OnSubmitButton_TouchUpInside; _submitButton.TouchUpInside += OnSubmitButton_TouchUpInside; }
public void Configure(ChatListUserCellModel chatUser) { _chatUser = chatUser; UILabelExtensions.SetupLabelAppearance(_dateLabel, chatUser.LastMessageDate, chatUser.IsNewMessage ? Colors.Black : Colors.ProfileGrayDarker, 11f, chatUser.IsNewMessage ? UIFontWeight.Semibold : UIFontWeight.Regular); UILabelExtensions.SetupLabelAppearance(_messageLabel, chatUser.LastMessage, Colors.MessageTextColor, 13f, chatUser.IsNewMessage ? UIFontWeight.Medium : UIFontWeight.Regular); var nameAttr = new UIStringAttributes { ForegroundColor = Colors.BlackChatName, Font = UIFont.SystemFontOfSize(15f, chatUser.IsNewMessage ? UIFontWeight.Semibold : UIFontWeight.Regular) }; var RoleAttr = new UIStringAttributes { ForegroundColor = Colors.BlackChatName, Font = UIFont.SystemFontOfSize(13f, chatUser.IsNewMessage ? UIFontWeight.Semibold : UIFontWeight.Regular) }; var letterCount = chatUser.MemberName.IndexOf("-"); var customString = new NSMutableAttributedString(chatUser.MemberName); customString.SetAttributes(nameAttr.Dictionary, new NSRange(0, letterCount)); customString.SetAttributes(RoleAttr.Dictionary, new NSRange(letterCount + 1, chatUser.MemberName.Length - (letterCount + 1))); _memberNameLabel.AttributedText = customString; _separatorLineView.BackgroundColor = Colors.ChatDivider; _profileImage.Image?.Dispose(); if (!string.IsNullOrEmpty(chatUser.MemberPhoto)) { _picture = string.Copy(chatUser.MemberPhoto); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_profileImage); } else { _profileImage.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_profileImage); } switch (chatUser.MemberPresence) { case MemberPresence.Online: _presenceView.BackgroundColor = Colors.UserOnline; _presenceView.Hidden = false; break; case MemberPresence.Recent: _presenceView.BackgroundColor = Colors.UserRecent; _presenceView.Hidden = false; break; case MemberPresence.Offline: _presenceView.Hidden = true; break; default: _presenceView.Hidden = true; break; } CustomUIExtensions.RoundView(_presenceView); _presenceView.Layer.BorderWidth = 2f; _presenceView.Layer.BorderColor = Colors.White.CGColor; _silentImage.Image?.Dispose(); _silentImage.Hidden = !chatUser.IsMemberMuted; _silentImage.Image = UIImage.FromBundle("silent").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); _silentImage.TintColor = Colors.ProfileGrayDarker; UILabelExtensions.SetupLabelAppearance(_unreadCountLabel, chatUser.UnreadMessagesCount.ToString(), Colors.White, 10f, UIFontWeight.Medium); _unreadCountLabel.Hidden = _unreadCountView.Hidden = chatUser.UnreadMessagesCount == 0; _unreadCountView.BackgroundColor = Colors.UnreadCount; CustomUIExtensions.RoundView(_unreadCountView); //_messageTrailConstraint.Constant = chatUser.UnreadMessagesCount > 0 || chatUser.IsMemberMuted ? _messageTrailConstraint.Constant : 0; _chatButton.TouchUpInside -= OnChatButton_TouchUpInside; _chatButton.TouchUpInside += OnChatButton_TouchUpInside; _profileImageButton.TouchUpInside -= OnProfileImageButton_TouchUpInside; _profileImageButton.TouchUpInside += OnProfileImageButton_TouchUpInside; }
public void Configure(ChatMessagesModel message, EventHandler <long> messageEvent, MemberPresence memberPresence) { _imageView.Image?.Dispose(); _imageView.Image = null; _messageId = message.MessageId; _messageEvent = messageEvent; var nameAttr = new UIStringAttributes { ForegroundColor = Colors.Black, Font = UIFont.SystemFontOfSize(15f, UIFontWeight.Semibold) }; var timeAttr = new UIStringAttributes { ForegroundColor = Colors.ProfileGrayDarker, Font = UIFont.SystemFontOfSize(11f, UIFontWeight.Regular) }; var messageAttributes = new UIStringAttributes { Font = message.FailedToSend ? UIFont.BoldSystemFontOfSize(15f) : UIFont.SystemFontOfSize(14f), ForegroundColor = message.FailedToSend ? Colors.Red : Colors.Black, ParagraphStyle = new NSMutableParagraphStyle { LineSpacing = 2f }, }; var customString = new NSMutableAttributedString(message.Name + message.MessageDate); customString.SetAttributes(nameAttr.Dictionary, new NSRange(0, message.Name.Length)); customString.SetAttributes(timeAttr.Dictionary, new NSRange(message.Name.Length + 1, message.MessageDate.Length - 1)); _nameLabel.AttributedText = customString; var attributedText = new NSMutableAttributedString(message.MessageData); attributedText.AddAttributes(messageAttributes, new NSRange(0, message.MessageData.Length)); _messageLabel.AttributedText = attributedText; if (!string.IsNullOrEmpty(message.Picture)) { _picture = string.Copy(message.Picture); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_imageView); } else { _imageView.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_imageView); } if (message.ShowPresense) { switch (memberPresence) { case MemberPresence.Online: _presenceView.BackgroundColor = Colors.UserOnline; _presenceView.Hidden = false; break; case MemberPresence.Recent: _presenceView.BackgroundColor = Colors.UserRecent; _presenceView.Hidden = false; break; case MemberPresence.Offline: _presenceView.Hidden = true; break; } } else { _presenceView.Hidden = true; } CustomUIExtensions.RoundView(_presenceView); _presenceView.Layer.BorderWidth = 1f; _presenceView.Layer.BorderColor = Colors.White.CGColor; _dividerLeftView.BackgroundColor = Colors.AlertDividerColor; _dividerRightView.BackgroundColor = Colors.AlertDividerColor; UILabelExtensions.SetupLabelAppearance(_dateLabel, message.HeaderDate, Colors.ChatDate, 12f, UIFontWeight.Medium); _dateView.Hidden = !message.ShowHeaderDate; _dateViewHeightConstraint.Constant = message.ShowHeaderDate ? LocalConstants.Chat_HeaderDateBig : LocalConstants.Chat_HeaderDateSmall; }
public void Configure(GetUsersInDivisionModel user, EventHandler <Tuple <ContactEventType, int> > contactEventHandler, ContactsType showContactType) { _imageView.Image?.Dispose(); _chatImage.Image?.Dispose(); _callImage.Image?.Dispose(); _showContactType = showContactType; _userId = user.UserId; _contactEventHandler = contactEventHandler; UILabelExtensions.SetupLabelAppearance(_nameLabel, $"{user.FirstName} {user.LastName}", Colors.ProfileGray, 14f, UIFontWeight.Semibold); UILabelExtensions.SetupLabelAppearance(_roleLabel, user.Position, Colors.Black, 13f); if (!string.IsNullOrEmpty(user?.Picture)) { _picture = string.Copy(user.Picture); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_imageView); } else { _imageView.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_imageView); } _callImage.Image = UIImage.FromBundle("tabbar_call_selected"); _callButton.TouchUpInside -= OnCallButton_TouchUpInside; _callButton.TouchUpInside += OnCallButton_TouchUpInside; _chatImage.Image = UIImage.FromBundle("user_chat"); _chatButton.TouchUpInside -= OnChatButton_TouchUpInside; _chatButton.TouchUpInside += OnChatButton_TouchUpInside; switch (showContactType) { case ContactsType.All: _chatButton.Hidden = false; _chatImage.Hidden = false; _callImage.Hidden = false; _callButton.Hidden = false; break; case ContactsType.Call: _chatButton.Hidden = true; _chatImage.Hidden = true; break; case ContactsType.Chat: _chatButton.Hidden = true; _chatImage.Hidden = true; _callImage.Image = UIImage.FromBundle("user_chat"); break; default: break; } }