예제 #1
0
        private void UpdateView()
        {
            _profileImage.Image?.Dispose();
            ImageService.Instance.LoadStream((token) => {
                return(ImageHelper.GetStreamFromImageByte(token, ViewModel.MemberProfileModel.Picture));
            }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_profileImage);
            CustomUIExtensions.RoundShadow(_profileImage);

            UILabelExtensions.SetupLabelAppearance(_nameLabel, $"{ViewModel.MemberProfileModel.FirstName} {ViewModel.MemberProfileModel.LastName}", Colors.White, 22f);

            if (!string.IsNullOrEmpty(ViewModel.MemberProfileModel.Description))
            {
                UILabelExtensions.SetupLabelAppearance(_descriptionLabel, ViewModel.MemberProfileModel.Description, Colors.White, 13f);
            }
            else
            {
                UILabelExtensions.SetupLabelAppearance(_descriptionLabel, ViewModel.MemberNoDescriptionLabel, Colors.ProfileGrayWhiter, 13f, italic: true);
            }

            _tableView.Source = new MemberSource(_tableView, ViewModel.MemberDetails);
            _tableView.ReloadData();

            _chatButton.TouchUpInside -= OnChatButton_TouchUpInside;
            _chatButton.TouchUpInside += OnChatButton_TouchUpInside;

            _callButton.TouchUpInside -= OnCallButton_TouchUpInside;
            _callButton.TouchUpInside += OnCallButton_TouchUpInside;
        }
예제 #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var titleViewMaxSize = ScreenWidth - LocalConstants.Chat_TotalIconsWidth;

            this.NavigationItem.TitleView = ViewModel.Chat == null
                ? CustomUIExtensions.SetupNavigationBarWithSubtitle(ViewModel.MemberName, ViewModel.MemberDetails, titleViewMaxSize)
                : CustomUIExtensions.SetupNavigationBarWithSubtitle(ViewModel.Chat.MemberName, ViewModel.Chat.MemberDetails, titleViewMaxSize);

            this.NavigationController.NavigationBar.TintColor           = Colors.MainBlue;
            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes {
                ForegroundColor = Colors.White
            };
            this.NavigationItem.LeftBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "back_white", CloseView);

            this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] {
                UIButtonExtensions.SetupBarWithTwoButtons(LocalConstants.TabBarIconSize, "options", Options),
                UIButtonExtensions.SetupBarWithTwoButtons(LocalConstants.TabBarIconSize, "call_white_medium", CallUser)
            };

            this.NavigationController.InteractivePopGestureRecognizer.Delegate = new UIGestureRecognizerDelegate();
            this.NavigationController.NavigationBar.BarTintColor = Colors.MainBlue;
            this.NavigationController.NavigationBar.Translucent  = false;
            this.NavigationController.SetNavigationBarHidden(false, true);
            this.NavigationController.NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            this.NavigationController.NavigationBar.ShadowImage = new UIImage();
            UIApplication.SharedApplication.StatusBarStyle      = UIStatusBarStyle.LightContent;
            _navBarView.BackgroundColor = Colors.MainBlue;

            UpdateTableView();
        }
예제 #3
0
        public void Configure(string hint, string submit, EventHandler <string> eventHandler, EventHandler <bool> scrollToRow)
        {
            _onSubmitButton = eventHandler;
            _scrollToRow    = scrollToRow;

            UITextFieldExtensions.SetupTextFieldAppearance(_textField, Colors.White, 22f, hint, Colors.White70, Colors.White, Colors.SelectBlue);
            UIButtonExtensions.SetupButtonAppearance(_submitButton, Colors.White, 18f, submit);
            CustomUIExtensions.SelectButton(_buttonView, Colors.White);

            _textField.AutocorrectionType = UITextAutocorrectionType.No;
            _textField.TextContentType    = new NSString("");
            _textField.ReturnKeyType      = UIReturnKeyType.Join;

            _submitButton.TouchUpInside -= OnSubmitButton_TouchUpInside;
            _submitButton.TouchUpInside += OnSubmitButton_TouchUpInside;

            _textField.EditingDidBegin -= OnTextField_EditingDidBegin;
            _textField.EditingDidBegin += OnTextField_EditingDidBegin;

            _textField.EditingDidEnd -= OnTextField_EditingDidEnd;
            _textField.EditingDidEnd += OnTextField_EditingDidEnd;

            _textField.ShouldReturn -= OnTextField_ShouldReturn;
            _textField.ShouldReturn += OnTextField_ShouldReturn;
        }
예제 #4
0
        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);
        }
예제 #5
0
        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;
        }
예제 #6
0
        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();
        }
예제 #7
0
 private void SetupView()
 {
     _closeButton.SetImage(UIImage.FromBundle("close_white"), UIControlState.Normal);
     _closeButton.TintColor          = Colors.White;
     _backgroundView.BackgroundColor = Colors.SelectBlue;
     UILabelExtensions.SetupLabelAppearance(_titleLabel, ViewModel.NewUser ? ViewModel.TitleMainLabel : ViewModel.TitleLabel, Colors.White, 24f);
     CustomUIExtensions.LabelShadow(_titleLabel);
 }
예제 #8
0
        private void ConfigureView()
        {
            LoadingAnimation(true);

            _sendButton.Enabled = false;
            _textView.Delegate  = this;

            _tableView.SectionHeaderHeight = 0;
            _tableView.TableHeaderView     = new UIView(new CGRect(0, 0, 0, 0.1f));

            _keyboardViewBottomConstraint.Constant = _keyboardBottomHeight;
            _tableViewBottomConstraint.Constant    = _keyboardAreaView.Frame.Height + _keyboardBottomHeight;

            AddStatusInTableView();

            _tableViewTapGesture.AddTarget(HandleTableDragGesture);
            _tableViewSwipeGesture.AddTarget(HandleTableDragGesture);

            _tableScrollView = _tableView as UIScrollView;

            _tableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            _tableView.BackgroundColor = Colors.White;

            _imageView1.Image?.Dispose();
            _imageView2.Image?.Dispose();
            _imageView3.Image?.Dispose();

            _imageView1.Image = UIImage.FromBundle("keyboard");
            _imageView2.Image = UIImage.FromBundle("image_picker");
            _imageView3.Image = UIImage.FromBundle("files");

            _keyboardAreaView.BackgroundColor = Colors.KeyboardView;
            _fakeAreaView.BackgroundColor     = Colors.KeyboardView;

            _textView.EnablesReturnKeyAutomatically = true;
            _textView.TextContainerInset            = new UIEdgeInsets(10, 10, 10, 10);
            _textView.TextColor = Colors.Black;
            _textView.Font      = UIFont.SystemFontOfSize(14f);
            _textView.Text      = string.Empty;

            CustomUIExtensions.CornerView(_sendView, 2);
            UILabelExtensions.SetupLabelAppearance(_sendLabel, ViewModel.SendMessageButton, Colors.ProfileGray, 15f, UIFontWeight.Medium);
            UILabelExtensions.SetupLabelAppearance(_placeholderLabel, ViewModel.TypeSomething, Colors.ProfileGrayDarker, 14f);

            _sendView.BackgroundColor = UIColor.Clear;

            _button1.TouchUpInside -= OnButton1_TouchUpInside;
            _button1.TouchUpInside += OnButton1_TouchUpInside;

            _button2.TouchUpInside -= OnButton2_TouchUpInside;
            _button2.TouchUpInside += OnButton2_TouchUpInside;

            _button3.TouchUpInside -= OnButton3_TouchUpInside;
            _button3.TouchUpInside += OnButton3_TouchUpInside;

            _sendButton.TouchUpInside -= OnSendButton_TouchUpInside;
            _sendButton.TouchUpInside += OnSendButton_TouchUpInside;
        }
예제 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _imageView.Image = UIImage.FromBundle(_image);
            _titleLabel.Text = _title;
            CustomUIExtensions.LabelShadow(_titleLabel);
            _descriptionLabel.Text          = _description;
            _backgroundView.BackgroundColor = Colors.MainBlue;
        }
예제 #10
0
        public void Configure(DivisionModel division)
        {
            _imageView.Image?.Dispose();

            ImageService.Instance.LoadStream((token) => {
                return(ImageHelper.GetStreamFromImageByte(token, division.Picture));
            }).ErrorPlaceholder("division_noimage", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_imageView);

            CustomUIExtensions.RoundShadow(_imageView);
            CustomUIExtensions.LabelShadow(_titleLabel);

            UILabelExtensions.SetupLabelAppearance(_titleLabel, division.Name, Colors.White, 16f, UIFontWeight.Bold);
            UILabelExtensions.SetupLabelAppearance(_subtitleLabel, division.Description, Colors.White, 12f);
        }
예제 #11
0
        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;
        }
        private void SetupView()
        {
            _backgroundView.BackgroundColor = Colors.SelectBlue;
            UILabelExtensions.SetupLabelAppearance(_titleLabel, ViewModel.TitleLabel, Colors.White, 24f);
            CustomUIExtensions.LabelShadow(_titleLabel);

            UILabelExtensions.SetupLabelAppearance(_pickerLabel, ViewModel.SelectPositionLabel, Colors.GrayIndicator, 16f, italic: true);
            UIButtonExtensions.SetupButtonAppearance(_submitButton, Colors.White, 18f, ViewModel.SelectButton);
            _pickerImage.Image = UIImage.FromBundle("dropdown_black");

            CustomUIExtensions.RoundShadow(_buttonPickerView);
            CustomUIExtensions.RoundShadow(_picker);
            CustomUIExtensions.RoundShadow(_pickerImage);
            CustomUIExtensions.SelectButton(_buttonView, Colors.White);
        }
예제 #13
0
        public void Configure(DivisionHeaderModel division)
        {
            this.BackgroundColor = Colors.MainBlue;
            UILabelExtensions.SetupLabelAppearance(_nameLabel, division.Name, Colors.White, 17f);
            UILabelExtensions.SetupLabelAppearance(_membersLabel, division.MembersCount, Colors.White, 15f);
            UILabelExtensions.SetupLabelAppearance(_descriptionLabel, division.Description, Colors.White, 15f);

            _backImage.Image    = UIImage.FromBundle("back_white");
            _membersImage.Image = UIImage.FromBundle("members");

            _profileImage.Image?.Dispose();
            ImageService.Instance.LoadStream((token) => {
                return(ImageHelper.GetStreamFromImageByte(token, division.Picture));
            }).ErrorPlaceholder("division_noimage", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_profileImage);
            CustomUIExtensions.RoundShadow(_profileImage);
        }
예제 #14
0
파일: Setup.cs 프로젝트: joaorpalma/Letter
        private static void ConfigureView()
        {
            UINavigationBar.Appearance.BarTintColor = Colors.BlueSetup;
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = Colors.White
            });

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                UINavigationBar.Appearance.LargeTitleTextAttributes = new UIStringAttributes {
                    ForegroundColor = Colors.White, Shadow = CustomUIExtensions.TextShadow()
                }
            }
            ;
        }
예제 #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.Alpha                    = 0.3f;
            this.View.BackgroundColor          = Colors.Black30;
            _backgroundView.Layer.CornerRadius = 2f;
            CustomUIExtensions.ViewShadow(_backgroundView);
            _viewButton.Layer.CornerRadius = 2f;

            switch (_inputType)
            {
            case QuestionType.Good:
                _viewButtonSmall.BackgroundColor = Colors.Green;
                _viewButton.BackgroundColor      = Colors.Green;
                break;

            case QuestionType.Bad:
                _viewButtonSmall.BackgroundColor = Colors.Red;
                _viewButton.BackgroundColor      = Colors.Red;
                break;

            case QuestionType.Normal:
                _viewButtonSmall.BackgroundColor = Colors.MainBlue;
                _viewButton.BackgroundColor      = Colors.MainBlue;
                break;

            default:
                _viewButtonSmall.BackgroundColor = Colors.MainBlue;
                _viewButton.BackgroundColor      = Colors.MainBlue;
                break;
            }

            UILabelExtensions.SetupLabelAppearance(_label, _text, Colors.Black, 20f, UIFontWeight.Medium);
            UIButtonExtensions.SetupButtonAppearance(_submitButton, Colors.White, 17f, _button);

            _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal);
            _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _closeButton.TintColor   = Colors.Black;

            _submitButton.TouchUpInside -= OnSubmitButton_TouchUpInside;
            _submitButton.TouchUpInside += OnSubmitButton_TouchUpInside;

            _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside;
            _closeButton.TouchUpInside += OnCloseButton_TouchUpInside;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _backgroundImage.Image?.Dispose();
            _profileImage.Image?.Dispose();

            this.View.Alpha                     = 0.3f;
            this.View.BackgroundColor           = Colors.Black30;
            _backgroundView.Layer.CornerRadius  = 2f;
            _buttonView.Layer.CornerRadius      = 2f;
            _backgroundImage.Layer.CornerRadius = 2f;
            CustomUIExtensions.ViewShadow(_backgroundView);

            _buttonView.BackgroundColor = Colors.MainBlue;
            UIButtonExtensions.SetupButtonAppearance(_button, Colors.White, 17f, _resources[_resources.Length - 1]);

            _nameLabel.AttributedText = new NSAttributedString(_name, font: UIFont.BoldSystemFontOfSize(16), foregroundColor: Colors.White, shadow: CustomUIExtensions.TextShadow());

            if (!string.IsNullOrEmpty(_photo))
            {
                ImageService.Instance.LoadStream((token) =>
                {
                    return(ImageHelper.GetStreamFromImageByte(token, _photo));
                }).ErrorPlaceholder("letter_round_big", ImageSource.CompiledResource).Transform(new BlurredTransformation(25f)).Into(_backgroundImage);

                ImageService.Instance.LoadStream((token) =>
                {
                    return(ImageHelper.GetStreamFromImageByte(token, _photo));
                }).ErrorPlaceholder("letter_round_big", ImageSource.CompiledResource).Transform(new RoundedTransformation(30)).Into(_profileImage);
            }
            else
            {
                _backgroundImage.BackgroundColor = Colors.MainBlue;
                _profileImage.Image = UIImage.FromBundle("letter_curved");
                CustomUIExtensions.CornerView(_profileImage, 3);
            }

            _backgroundImage.ContentMode = UIViewContentMode.ScaleToFill;

            _button.TouchUpInside -= OnCloseButton_TouchUpInside;
            _button.TouchUpInside += OnCloseButton_TouchUpInside;

            SetupTableView();
        }
예제 #17
0
        private void SetupView()
        {
            if (PhoneModelExtensions.IsIphoneX())
            {
                _buttonHeightConstraint.Constant += 20;
            }

            this.Title = ViewModel.Division.Name;
            _profileHeaderView.BackgroundColor = Colors.MainBlue;

            UILabelExtensions.SetupLabelAppearance(_membersLabel, $"{ViewModel.Division.UserCount} {ViewModel.MembersLabel}", Colors.White, 13f);

            if (!string.IsNullOrEmpty(ViewModel.Division.Description))
            {
                UILabelExtensions.SetupLabelAppearance(_descriptionLabel, ViewModel.Division.Description, Colors.White, 13f);
            }
            else
            {
                UILabelExtensions.SetupLabelAppearance(_descriptionLabel, ViewModel.DivisionNoDescription, Colors.ProfileGrayWhiter, 13f, italic: true);
            }

            _memberImage.Image = UIImage.FromBundle("members");

            _profileImage.Image?.Dispose();
            ImageService.Instance.LoadStream((token) => {
                return(ImageHelper.GetStreamFromImageByte(token, ViewModel.Division.Picture));
            }).ErrorPlaceholder("division_noimage", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_profileImage);
            CustomUIExtensions.RoundShadow(_profileImage);

            _buttonView1.BackgroundColor = Colors.ConnectViewButton1;
            _buttonView2.BackgroundColor = Colors.ConnectViewButton2;

            UIButtonExtensions.SetupButtonAppearance(_button1, Colors.MainBlue, 15f, ViewModel.SendEmailLabel);
            UIButtonExtensions.SetupButtonAppearance(_button2, Colors.MainBlue, 15f, ViewModel.CallLabel);

            _button1.TouchUpInside -= OnButton1_TouchUpInside;
            _button1.TouchUpInside += OnButton1_TouchUpInside;

            _button2.TouchUpInside -= OnButton2_TouchUpInside;
            _button2.TouchUpInside += OnButton2_TouchUpInside;

            _tableView.Source = new DivisionSource(_tableView, ViewModel.OrganizationInfo, ViewModel.ProfileDetails);
            _tableView.ReloadData();
        }
예제 #18
0
        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;
        }
예제 #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.Alpha                    = 0.3f;
            this.View.BackgroundColor          = Colors.Black30;
            _backgroundView.Layer.CornerRadius = 2f;
            CustomUIExtensions.ViewShadow(_backgroundView);

            UILabelExtensions.SetupLabelAppearance(_titleLabel, _locationResources["Title"], Colors.Black, 20f, UIFontWeight.Semibold);

            _image1.Image = UIImage.FromBundle("letter_curved");
            UILabelExtensions.SetupLabelAppearance(_title1, _locationResources["TitleLetter"], Colors.Black, 18f, UIFontWeight.Medium);
            UILabelExtensions.SetupLabelAppearance(_description1, _locationResources["DescriptionLetter"], Colors.DescriptionCall, 11f);

            _image2.Image = UIImage.FromBundle("call_cellular");
            UILabelExtensions.SetupLabelAppearance(_title2, _locationResources["TitlePhone"], Colors.Black, 18f, UIFontWeight.Medium);
            UILabelExtensions.SetupLabelAppearance(_description2, _locationResources["DescriptionPhone"], Colors.DescriptionCall, 11f);

            _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal);
            _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _closeButton.TintColor   = Colors.Black;

            _separatorView.BackgroundColor = Colors.AlertDividerColor;

            _button1.TouchUpInside -= OnButton1_TouchUpInside;
            _button1.TouchUpInside += OnButton1_TouchUpInside;

            if (_showPhoneOption)
            {
                _button2.TouchUpInside -= OnButton2_TouchUpInside;
                _button2.TouchUpInside += OnButton2_TouchUpInside;
            }
            else
            {
                _hideButtonView.Hidden = false;
                _hideButtonView.Alpha  = 0.6f;
            }

            _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside;
            _closeButton.TouchUpInside += OnCloseButton_TouchUpInside;
        }
예제 #20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.Alpha                    = 0.3f;
            this.View.BackgroundColor          = Colors.Black30;
            _backgroundView.Layer.CornerRadius = 2f;
            CustomUIExtensions.ViewShadow(_backgroundView);

            _separatorView.BackgroundColor = Colors.AlertDividerColor;

            UILabelExtensions.SetupLabelAppearance(_titleLabel, _title, Colors.Black, 18f, UIFontWeight.Medium);

            _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal);
            _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _closeButton.TintColor   = Colors.Black;

            _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside;
            _closeButton.TouchUpInside += OnCloseButton_TouchUpInside;

            SetupTableView();
        }
예제 #21
0
        private void SetupView(bool canContinue)
        {
            _descriptionLabel.Hidden = false;

            if (canContinue)
            {
                UIButtonExtensions.SetupButtonAppearance(_continueButton, Colors.Black, 18f, ViewModel.SubmitButton, UIFontWeight.Light);
                CustomUIExtensions.SelectButton(_continueView, Colors.Black);

                _continueButton.TouchUpInside -= OnContinueButton_TouchUpInside;
                _continueButton.TouchUpInside += OnContinueButton_TouchUpInside;

                ShouldContinue(true);
            }
            else
            {
                UIButtonExtensions.SetupButtonUnderlineAppearance(_leaveDivisionButton, Colors.Black, 14f, ViewModel.LeaveButton, UIFontWeight.Light);
                UIButtonExtensions.SetupButtonUnderlineAppearance(_logoutButton, Colors.Black, 14f, ViewModel.LogoutButton, UIFontWeight.Light);
                UILabelExtensions.SetupLabelAppearance(_helpLabel, ViewModel.HelpLabel, Colors.Black, 14f, UIFontWeight.Light);
                UIButtonExtensions.SetupButtonUnderlineAppearance(_helpButton, Colors.SelectBlue, 14f, ViewModel.Division.Email);

                ShouldContinue(false);

                _reloadButton.TouchUpInside -= OnReloadButton_TouchUpInside;
                _reloadButton.TouchUpInside += OnReloadButton_TouchUpInside;

                _leaveDivisionButton.TouchUpInside -= OnLeaveDivisionButton_TouchUpInside;
                _leaveDivisionButton.TouchUpInside += OnLeaveDivisionButton_TouchUpInside;

                _logoutButton.TouchUpInside -= OnLogoutButton_TouchUpInside;
                _logoutButton.TouchUpInside += OnLogoutButton_TouchUpInside;

                _helpButton.TouchUpInside -= OnHelpButton_TouchUpInside;
                _helpButton.TouchUpInside += OnHelpButton_TouchUpInside;
            }
        }
예제 #22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.Alpha = 0.3f;

            this.View.BackgroundColor          = Colors.Black30;
            _backGroundView.Layer.CornerRadius = 2f;
            _buttonColorBig.Layer.CornerRadius = 2f;
            CustomUIExtensions.ViewShadow(_backGroundView);

            UILabelExtensions.SetupLabelAppearance(_titleLabel, _title, Colors.Black, 24f, UIFontWeight.Medium);

            UILabelExtensions.SetupLabelAppearance(_filterByNameLabel, _filters[0].Title, Colors.Black, 14f);
            UILabelExtensions.SetupLabelAppearance(_filterByNameDescription, _filters[0].Description, Colors.GrayLabel, 12f);

            UILabelExtensions.SetupLabelAppearance(_switchLabel, _filters[1].Title, Colors.Black, 14f);
            UILabelExtensions.SetupLabelAppearance(_descriptionLabel, _filters[1].Description, Colors.GrayLabel, 12f);

            _buttonColorBig.BackgroundColor   = Colors.MainBlue;
            _buttonColorSmall.BackgroundColor = Colors.MainBlue;
            UIButtonExtensions.SetupButtonAppearance(_button, Colors.White, 17f, _buttonText);

            _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal);
            _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _closeButton.TintColor   = Colors.Black;

            _filterByNameSwitch.On = _filters[0].IsActive;
            _switch.On             = _filters[1].IsActive;

            _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside;
            _closeButton.TouchUpInside += OnCloseButton_TouchUpInside;

            _button.TouchUpInside -= OnSubmitButton_TouchUpInside;
            _button.TouchUpInside += OnSubmitButton_TouchUpInside;
        }
예제 #23
0
        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;
            }
        }
예제 #24
0
 public void Configure(string text)
 {
     this.BackgroundColor = Colors.SelectBlue;
     UILabelExtensions.SetupLabelAppearance(_label, text, Colors.White, 16f, UIFontWeight.Medium);
     CustomUIExtensions.LabelShadow(_label);
 }
예제 #25
0
        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;
        }
예제 #26
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DismissKeyboardOnBackgroundTap();

            this.View.Alpha = 0.3f;

            if (_questionType == QuestionType.Bad)
            {
                _buttonView1.BackgroundColor = Colors.Red;
                _buttonView2.BackgroundColor = Colors.Red;
                UILabelExtensions.SetupLabelAppearance(_subtitleLabel, _subtitle, Colors.Red, 30, UIFontWeight.Bold);
            }
            else
            {
                _buttonView1.BackgroundColor = Colors.MainBlue;
                _buttonView2.BackgroundColor = Colors.MainBlue;
                UILabelExtensions.SetupLabelAppearance(_subtitleLabel, _subtitle, Colors.SomeBlue, 30, UIFontWeight.Bold);
            }

            switch (_inputType)
            {
            case InputType.Email:
                _textField.KeyboardType = UIKeyboardType.EmailAddress;
                break;

            case InputType.Number:
                _textField.KeyboardType = UIKeyboardType.NumberPad;
                break;

            case InputType.Phone:
                _textField.KeyboardType = UIKeyboardType.PhonePad;
                break;

            case InputType.Password:
                _textField.SecureTextEntry = true;
                break;

            default:
                _textField.KeyboardType = UIKeyboardType.Default;
                break;
            }

            _textField.AutocorrectionType = UITextAutocorrectionType.No;


            if (string.IsNullOrEmpty(_subtitle))
            {
                _subtitleLabel.Text   = string.Empty;
                _subtitleLabel.Hidden = true;
                _subtitleLabel.Frame  = new CGRect();
                _subtitleHeightConstraint.Constant = 0;
            }

            this.View.BackgroundColor          = Colors.Black30;
            _backgroundView.Layer.CornerRadius = 2f;
            _buttonView.Layer.CornerRadius     = 2f;
            CustomUIExtensions.ViewShadow(_backgroundView);

            UILabelExtensions.SetupLabelAppearance(_titleLabel, _title, Colors.Black, 18);
            UITextFieldExtensions.SetupField(this.View, 0, _hint, _textField, _indicatorView, _textFieldHeightConstraint, _indicatorLabel);
            UIButtonExtensions.SetupButtonAppearance(_confirmButton, Colors.White, 17f, _confirmButtonText);

            if (!string.IsNullOrEmpty(_inputContent))
            {
                _textField.Text       = _inputContent;
                _indicatorLabel.Alpha = 1;
            }

            _closeButton.SetImage(UIImage.FromBundle("close_black"), UIControlState.Normal);
            _closeButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _closeButton.TintColor   = Colors.Black;

            _closeButton.TouchUpInside -= OnCloseButton_TouchUpInside;
            _closeButton.TouchUpInside += OnCloseButton_TouchUpInside;

            _confirmButton.TouchUpInside -= OnConfirmButton_TouchUpInside;
            _confirmButton.TouchUpInside += OnConfirmButton_TouchUpInside;
        }
예제 #27
0
        public void Configure(ProfileHeaderModel profile)
        {
            _profile             = profile;
            this.BackgroundColor = Colors.MainBlue;
            UILabelExtensions.SetupLabelAppearance(_nameLabel, profile.Name, Colors.White, 22f);
            UITextFieldExtensions.SetupTextFieldAppearance(_descriptionField, Colors.White, 14f, DescriptionField, Colors.White70, Colors.White, Colors.MainBlue);

            _descriptionField.ReturnKeyType = UIReturnKeyType.Done;

            _descriptionField.AdjustsFontSizeToFitWidth = true;
            _descriptionField.MinimumFontSize           = 11f;

            _descriptionField.ShouldReturn -= TextFieldShouldReturn;
            _descriptionField.ShouldReturn += TextFieldShouldReturn;

            _settingsButton.SetImage(UIImage.FromBundle("settings"), UIControlState.Normal);
            _settingsButton.ContentMode = UIViewContentMode.ScaleAspectFit;
            _settingsButton.TintColor   = Colors.White;

            _profileImage.Image?.Dispose();
            ImageService.Instance.LoadStream((token) =>
            {
                return(ImageHelper.GetStreamFromImageByte(token, profile.Picture));
            }).ErrorPlaceholder("add_photo", ImageSource.CompiledResource).Transform(new CircleTransformation()).Into(_profileImage);
            CustomUIExtensions.RoundShadow(_profileImage);

            CustomUIExtensions.LabelShadow(_nameLabel);

            if (!string.IsNullOrEmpty(profile.Description))
            {
                _descriptionField.Text = profile.Description;
            }
            else
            {
                _descriptionField.Font = UIFont.ItalicSystemFontOfSize(14f);
            }

            _descriptionField.ShouldChangeCharacters = OnDescriptionField_ShouldChangeCharacters;

            if (PhoneModelExtensions.IsIphoneX())
            {
                _settingsHeightConstraint.Constant = 25;
                _settingsWidthConstraint.Constant  = 8;
            }
            else if (!UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                _settingsHeightConstraint.Constant = 23;
            }

            _descriptionField.EditingDidBegin -= OnDescriptionField_EditingDidBegin;
            _descriptionField.EditingDidBegin += OnDescriptionField_EditingDidBegin;

            _descriptionField.EditingDidEnd -= OnDescriptionField_EditingDidEnd;
            _descriptionField.EditingDidEnd += OnDescriptionField_EditingDidEnd;

            _settingsButton.TouchUpInside -= OnConfigButton_TouchUpInside;
            _settingsButton.TouchUpInside += OnConfigButton_TouchUpInside;

            _profileButton.TouchUpInside -= OnProfileButton_TouchUpInside;
            _profileButton.TouchUpInside += OnProfileButton_TouchUpInside;
        }
예제 #28
0
        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;
        }