private void SetupTable()
        {
            _usersTable        = new UITableView();
            _usersTable.Hidden = true;
            View.AddSubview(_usersTable);

            _usersTable.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _recepientTextField, 25);
            _usersTable.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _usersTable.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _usersTable.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            _userTableSource = new FollowTableViewSource(_transferFacade.UserFriendPresenter, _usersTable, true);
            _userTableSource.ScrolledToBottom += GetItems;
            _userTableSource.CellAction       += CellAction;
            _usersTable.Source          = _userTableSource;
            _usersTable.AllowsSelection = false;
            _usersTable.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            _usersTable.LayoutMargins   = UIEdgeInsets.Zero;
            _usersTable.RegisterClassForCellReuse(typeof(FollowViewCell), nameof(FollowViewCell));
            _usersTable.RegisterNibForCellReuse(UINib.FromName(nameof(FollowViewCell), NSBundle.MainBundle), nameof(FollowViewCell));
            _usersTable.RegisterClassForCellReuse(typeof(LoaderCell), nameof(LoaderCell));
            _usersTable.RowHeight = 70f;

            _usersLoader = new UIActivityIndicatorView();
            _usersLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            _usersLoader.Color            = Constants.R231G72B0;
            _usersLoader.HidesWhenStopped = true;
            _usersLoader.StopAnimating();
            View.AddSubview(_usersLoader);

            _userLoaderHorizontalAlignment = _usersLoader.AutoAlignAxis(ALAxis.Horizontal, _usersTable);
            _usersLoader.AutoAlignAxis(ALAxis.Vertical, _usersTable);
        }
        private void CreateView()
        {
            _commentTextView = new UITextView();
            _commentTextView.Layer.BorderColor  = Helpers.Constants.R244G244B246.CGColor;
            _commentTextView.Layer.BorderWidth  = 1f;
            _commentTextView.Layer.CornerRadius = 20f;
            _commentTextView.TextContainerInset = new UIEdgeInsets(10, 20, 10, 15);
            _commentTextView.Font    = Constants.Regular14;
            _commentTextView.Bounces = false;
            _commentTextView.ShowsVerticalScrollIndicator = false;
            _commentsTextViewDelegate = new CommentsTextViewDelegate();

            _commentsTextViewDelegate.ChangedAction += (gh) =>
            {
                _commentViewHeight.Constant = _commentTextViewHeight.Constant = gh;
                if (_postToEdit != null && _postToEdit.Editing)
                {
                    _saveButton.Enabled = _postToEdit.Body != _commentTextView.Text;
                }
            };

            _commentTextView.Delegate = _commentsTextViewDelegate;

            _sendButton = new UIButton();
            _sendButton.Layer.BorderColor  = Constants.R244G244B246.CGColor;
            _sendButton.Layer.BorderWidth  = 1f;
            _sendButton.Layer.CornerRadius = 20f;
            _sendButton.SetImage(UIImage.FromBundle("ic_send_comment"), UIControlState.Normal);
            _sendButton.TouchDown += CreateComment;

            _sendProgressBar                  = new UIActivityIndicatorView();
            _sendProgressBar.Color            = Constants.R231G72B0;
            _sendProgressBar.HidesWhenStopped = true;

            _commentView           = new UIStackView(new UIView[] { _commentTextView, _sendButton, _sendProgressBar });
            _commentView.Alignment = UIStackViewAlignment.Center;
            _commentView.Spacing   = 10;

            _sendProgressBar.AutoSetDimension(ALDimension.Width, 40);
            _sendProgressBar.AutoSetDimension(ALDimension.Height, 40);

            var backgroundView = new UIView();

            backgroundView.TranslatesAutoresizingMaskIntoConstraints = false;
            _commentView.InsertSubview(backgroundView, 0);
            backgroundView.AutoPinEdgesToSuperviewEdges();

            _sendButton.AutoSetDimension(ALDimension.Width, 40);
            _sendButton.AutoSetDimension(ALDimension.Height, 40);

            _commentsTable = new UITableView();

            _rootView      = new UIStackView(new UIView[] { _commentsTable, _commentView });
            _rootView.Axis = UILayoutConstraintAxis.Vertical;
            View.AddSubview(_rootView);

            _rootView.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            if (DeviceModel.Model(DeviceHardware.HardwareModel) == "iPhone10,6")
            {
                _rootView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 34);
            }
            else
            {
                _rootView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            }
            _rootView.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _rootView.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            _commentTextViewHeight     = _commentTextView.AutoSetDimension(ALDimension.Height, 40, NSLayoutRelation.GreaterThanOrEqual);
            _commentViewHeight         = _commentView.AutoSetDimension(ALDimension.Height, 40, NSLayoutRelation.GreaterThanOrEqual);
            _commentView.LayoutMargins = new UIEdgeInsets(10, 15, 10, 15);
            _commentView.LayoutMarginsRelativeArrangement = true;

            _saveButton = new UIButton();
            _saveButton.SetTitle("Save", UIControlState.Normal);
            _saveButton.SetTitleColor(UIColor.FromRGB(255, 44, 5), UIControlState.Normal);
            _saveButton.TouchDown         += SaveTap;
            _saveButton.Layer.BorderColor  = Constants.R244G244B246.CGColor;
            _saveButton.Layer.BorderWidth  = 1f;
            _saveButton.Layer.CornerRadius = 20f;
            _saveButton.Font = Constants.Semibold14;

            _editProgressBar                  = new UIActivityIndicatorView();
            _editProgressBar.Color            = Constants.R231G72B0;
            _editProgressBar.HidesWhenStopped = true;

            _cancelButton = new UIButton();
            _cancelButton.SetTitle("Cancel", UIControlState.Normal);
            _cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            _cancelButton.TouchDown         += CancelTap;
            _cancelButton.Layer.BorderColor  = Constants.R244G244B246.CGColor;
            _cancelButton.Layer.BorderWidth  = 1f;
            _cancelButton.Layer.CornerRadius = 20f;
            _cancelButton.Font = Constants.Regular14;

            _buttonsContainer = new UIStackView(new UIView[] { _cancelButton, _saveButton, _editProgressBar });
            _buttonsContainer.AutoSetDimension(ALDimension.Height, 50);
            _buttonsContainer.Spacing       = 15;
            _buttonsContainer.Distribution  = UIStackViewDistribution.FillEqually;
            _buttonsContainer.LayoutMargins = new UIEdgeInsets(0, 15, 10, 15);
            _buttonsContainer.LayoutMarginsRelativeArrangement = true;
            _buttonsContainer.Hidden = true;
            _rootView.AddArrangedSubview(_buttonsContainer);

            _tableProgressBar = new UIActivityIndicatorView();
            _tableProgressBar.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            _tableProgressBar.Color            = Constants.R231G72B0;
            _tableProgressBar.HidesWhenStopped = true;
            _rootView.AddSubview(_tableProgressBar);
            _tableProgressBar.AutoAlignAxis(ALAxis.Horizontal, _commentsTable);
            _tableProgressBar.AutoAlignAxis(ALAxis.Vertical, _commentsTable);
        }
        private void CreateView()
        {
            GetPostSize();
            SetImage();

            var photoTitleSeparator = new UIView();

            photoTitleSeparator.BackgroundColor = Constants.R245G245B245;

            titleTextField = new UITextView();
            titleTextField.ScrollEnabled = false;
            titleTextField.Font          = Constants.Semibold14;
            titleEditImage       = new UIImageView();
            titleEditImage.Image = UIImage.FromBundle("ic_edit");

            var titleDescriptionSeparator = new UIView();

            titleDescriptionSeparator.BackgroundColor = Constants.R245G245B245;

            descriptionTextField = new UITextView();
            descriptionTextField.ScrollEnabled = false;
            descriptionTextField.Font          = Constants.Regular14;
            descriptionEditImage       = new UIImageView();
            descriptionEditImage.Image = UIImage.FromBundle("ic_edit");

            var descriptionHashtagSeparator = new UIView();

            descriptionHashtagSeparator.BackgroundColor = Constants.R245G245B245;

            tagField           = new UILabel();
            tagField.Text      = "Hashtag";
            tagField.Font      = Constants.Regular14;
            tagField.TextColor = Constants.R151G155B158;
            tagField.UserInteractionEnabled = true;
            var tap = new UITapGestureRecognizer(OpenTagPicker);

            tagField.AddGestureRecognizer(tap);

            hashtagImage       = new UIImageView();
            hashtagImage.Image = UIImage.FromBundle("ic_hash");

            var hashtagCollectionSeparator = new UIView();

            hashtagCollectionSeparator.BackgroundColor = Constants.R245G245B245;

            postPhotoButton = new UIButton();
            postPhotoButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.PublishButtonText), UIControlState.Normal);
            postPhotoButton.SetTitle("", UIControlState.Disabled);
            postPhotoButton.Layer.CornerRadius = 25;
            postPhotoButton.TitleLabel.Font    = Constants.Semibold14;
            postPhotoButton.TouchDown         += PostPhoto;

            loadingView                  = new UIActivityIndicatorView();
            loadingView.Color            = UIColor.White;
            loadingView.HidesWhenStopped = true;

            mainScroll.Bounces = false;
            mainScroll.AddSubview(photoTitleSeparator);
            mainScroll.AddSubview(titleTextField);
            mainScroll.AddSubview(titleEditImage);
            mainScroll.AddSubview(titleDescriptionSeparator);
            mainScroll.AddSubview(descriptionTextField);
            mainScroll.AddSubview(descriptionEditImage);
            mainScroll.AddSubview(descriptionHashtagSeparator);
            mainScroll.AddSubview(tagField);
            mainScroll.AddSubview(hashtagImage);
            mainScroll.AddSubview(hashtagCollectionSeparator);
            mainScroll.AddSubview(tagsCollectionView);
            mainScroll.AddSubview(postPhotoButton);
            mainScroll.AddSubview(loadingView);

            if (photoView != null)
            {
                photoTitleSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, photoView, 15f);
            }
            else
            {
                photoTitleSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, photoCollection, 15f);
            }

            photoTitleSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, _separatorMargin);
            photoTitleSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, _separatorMargin);
            photoTitleSeparator.AutoSetDimension(ALDimension.Height, 1f);
            photoTitleSeparator.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width - _separatorMargin * 2);

            titleTextField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, photoTitleSeparator, 17f);
            titleTextField.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator, -5f);

            titleEditImage.AutoSetDimensionsToSize(new CGSize(18, 18));
            titleEditImage.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            titleEditImage.AutoPinEdge(ALEdge.Left, ALEdge.Right, titleTextField, 5f);
            titleEditImage.AutoAlignAxis(ALAxis.Horizontal, titleTextField);

            titleDescriptionSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, titleTextField, 17f);
            titleDescriptionSeparator.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            titleDescriptionSeparator.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            titleDescriptionSeparator.AutoSetDimension(ALDimension.Height, 1f);

            descriptionTextField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, titleDescriptionSeparator, 17f);
            descriptionTextField.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator, -5f);

            descriptionEditImage.AutoSetDimensionsToSize(new CGSize(18, 18));
            descriptionEditImage.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            descriptionEditImage.AutoPinEdge(ALEdge.Left, ALEdge.Right, descriptionTextField, 5f);
            descriptionEditImage.AutoAlignAxis(ALAxis.Horizontal, descriptionTextField);

            descriptionHashtagSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, descriptionTextField, 17f);
            descriptionHashtagSeparator.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            descriptionHashtagSeparator.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            descriptionHashtagSeparator.AutoSetDimension(ALDimension.Height, 1f);

            tagField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, descriptionHashtagSeparator);
            tagField.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            tagField.AutoSetDimension(ALDimension.Height, 70f);

            hashtagImage.AutoSetDimensionsToSize(new CGSize(15, 17));
            hashtagImage.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            hashtagImage.AutoPinEdge(ALEdge.Left, ALEdge.Right, tagField, 5f);
            hashtagImage.AutoAlignAxis(ALAxis.Horizontal, tagField);

            hashtagCollectionSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, tagField);
            hashtagCollectionSeparator.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            hashtagCollectionSeparator.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            hashtagCollectionSeparator.AutoSetDimension(ALDimension.Height, 1f);

            tagsCollectionView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, hashtagCollectionSeparator, 25f);
            tagsCollectionView.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            tagsCollectionView.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            tagsCollectionHeight = tagsCollectionView.AutoSetDimension(ALDimension.Height, 0f);

            postPhotoButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, tagsCollectionView, 40f);
            postPhotoButton.AutoPinEdge(ALEdge.Left, ALEdge.Left, photoTitleSeparator);
            postPhotoButton.AutoPinEdge(ALEdge.Right, ALEdge.Right, photoTitleSeparator);
            postPhotoButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 35f);
            postPhotoButton.AutoSetDimension(ALDimension.Height, 50f);

            loadingView.AutoAlignAxis(ALAxis.Horizontal, postPhotoButton);
            loadingView.AutoAlignAxis(ALAxis.Vertical, postPhotoButton);
        }
        public UIView CreateView()
        {
            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            UserInteractionEnabled = true;

            #region topPanel

            topView = new UIView();
            topView.BackgroundColor = UIColor.Clear;
            topView.Frame           = new CGRect(mainMargin - 5, mainMargin, screenWidth - mainMargin * 2, topViewHeight);

            avatar = new UIImageView(new CGRect(5, 5, photoSide, photoSide));
            avatar.Layer.CornerRadius     = photoSide / 2;
            avatar.ClipsToBounds          = true;
            avatar.UserInteractionEnabled = true;
            avatar.ContentMode            = UIViewContentMode.ScaleAspectFill;
            avatar.BackgroundColor        = UIColor.Clear;
            powerFrame = new CircleFrame(avatar, new CGRect(0, 0, powerFrameSide, powerFrameSide));

            infoView              = new UIStackView();
            infoView.Axis         = UILayoutConstraintAxis.Vertical;
            infoView.Alignment    = UIStackViewAlignment.Fill;
            infoView.Distribution = UIStackViewDistribution.FillEqually;
            infoView.Frame        = new CGRect(powerFrameSide + topViewSpacing, 0, screenWidth - mainMargin * 2 - (powerFrameSide + topViewSpacing), topViewHeight + 8);

            userName = new UILabel();
            userName.UserInteractionEnabled = false;
            userName.TextColor       = Helpers.Constants.R15G24B30;
            userName.Font            = Helpers.Constants.Semibold20;
            userName.Lines           = 1;
            userName.LineBreakMode   = UILineBreakMode.TailTruncation;
            userName.BackgroundColor = UIColor.Clear;

            userLocation = new UILabel();
            userLocation.UserInteractionEnabled = false;
            userLocation.TextColor       = Helpers.Constants.R151G155B158;
            userLocation.Font            = Helpers.Constants.Regular14;
            userLocation.Lines           = 1;
            userLocation.LineBreakMode   = UILineBreakMode.TailTruncation;
            userLocation.BackgroundColor = UIColor.Clear;

            var topEmptyView    = new UIView();
            var bottomEmptyView = new UIView();

            infoView.AddArrangedSubview(topEmptyView);
            infoView.AddArrangedSubview(userName);
            infoView.AddArrangedSubview(userLocation);
            infoView.AddArrangedSubview(bottomEmptyView);

            topView.AddSubview(powerFrame);
            topView.AddSubview(infoView);
            AddSubview(topView);

            #endregion

            attributedLabel       = new TTTAttributedLabel();
            attributedLabel.Lines = 0;
            attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link;

            var prop = new NSDictionary();
            attributedLabel.LinkAttributes       = prop;
            attributedLabel.ActiveLinkAttributes = prop;

            attributedLabel.Delegate = new TTTAttributedLabelCustomDelegate();

            at = new NSMutableAttributedString();

            followButton = new UIButton();
            followButton.BackgroundColor = UIColor.Clear;
            AddSubview(followButton);

            followProgress = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
            followProgress.HidesWhenStopped = false;
            followProgress.StartAnimating();
            AddSubview(followProgress);

            #region originality

            originalityContainer = new UIView();
            originalityContainer.BackgroundColor    = Helpers.Constants.R250G250B250;
            originalityContainer.Layer.CornerRadius = 10;

            originalityLabel = new UILabel();
            originalityLabel.UserInteractionEnabled = false;
            //originalityLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Originality);
            originalityLabel.TextColor     = UIColor.Black;
            originalityLabel.Font          = Helpers.Constants.Regular14;
            originalityLabel.Lines         = 1;
            originalityLabel.LineBreakMode = UILineBreakMode.TailTruncation;

            originality = new UILabel();
            originality.UserInteractionEnabled = false;
            originality.Text      = "100%";
            originality.TextColor = Helpers.Constants.R255G34B5;
            originality.Font      = Helpers.Constants.Semibold14;
            originality.Lines     = 1;

            originalityContainer.AddSubview(originalityLabel);
            originalityContainer.AddSubview(originality);

            //contentView.AddSubview(originalityContainer);

            #endregion

            #region stats

            statsView              = new UIStackView();
            statsView.Axis         = UILayoutConstraintAxis.Horizontal;
            statsView.Alignment    = UIStackViewAlignment.Fill;
            statsView.Distribution = UIStackViewDistribution.Fill;
            statsView.TranslatesAutoresizingMaskIntoConstraints = false;

            photos    = new UIButton();
            following = new UIButton();
            followers = new UIButton();

            var emptySpace = new UIView();

            var firstSpacing  = new UIView();
            var secondSpacing = new UIView();

            statsView.AddArrangedSubview(photos);
            statsView.AddArrangedSubview(firstSpacing);
            statsView.AddArrangedSubview(following);
            statsView.AddArrangedSubview(secondSpacing);
            statsView.AddArrangedSubview(followers);
            statsView.AddArrangedSubview(emptySpace);

            statsContainer = new UIView();
            statsContainer.AddSubview(statsView);

            AddSubview(statsContainer);

            #endregion

            #region balance

            balanceContainer = new UIView();
            balanceContainer.UserInteractionEnabled = true;

            var topSeparator    = new UIView();
            var bottomSeparator = new UIView();
            topSeparator.BackgroundColor = bottomSeparator.BackgroundColor = Helpers.Constants.R245G245B245;

            var balanceImage = new UIImageView();
            balanceImage.Image = UIImage.FromBundle("ic_balance");

            var balanceLabel = new UILabel();
            balanceLabel.UserInteractionEnabled = false;
            balanceLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.AccountBalance);
            balanceLabel.TextColor = UIColor.Black;
            balanceLabel.Font      = Helpers.Constants.Regular14;
            balanceLabel.Lines     = 1;

            balance = new UILabel();
            balance.UserInteractionEnabled = false;
            balance.TextColor     = Helpers.Constants.R255G34B5;
            balance.TextAlignment = UITextAlignment.Right;
            balance.Font          = Helpers.Constants.Semibold14;
            balance.Lines         = 1;

            var balanceArrow = new UIImageView();
            balanceArrow.Image = UIImage.FromBundle("ic_forward");

            balanceContainer.AddSubview(topSeparator);
            balanceContainer.AddSubview(bottomSeparator);
            balanceContainer.AddSubview(balanceImage);
            balanceContainer.AddSubview(balanceLabel);
            balanceContainer.AddSubview(balanceArrow);
            balanceContainer.AddSubview(balance);

            UITapGestureRecognizer balanceTap = new UITapGestureRecognizer(() =>
            {
                ProfileAction?.Invoke(ActionType.Balance);
            });
            balanceContainer.AddGestureRecognizer(balanceTap);
//#if DEBUG
            AddSubview(balanceContainer);
//#endif
            #endregion

            AddSubview(bottomSeparator);

            #region constraints

            /*
             * originalityLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, extraMargin);
             * originalityLabel.AutoAlignAxis(ALAxis.Horizontal, originalityContainer);
             * originality.AutoPinEdgeToSuperviewEdge(ALEdge.Right, extraMargin);
             * originality.AutoAlignAxis(ALAxis.Horizontal, originalityContainer);
             */

            statsView.AutoPinEdgesToSuperviewEdges();

            topSeparator.AutoSetDimension(ALDimension.Height, 1);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            bottomSeparator.AutoSetDimension(ALDimension.Height, 1);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            followProgress.AutoAlignAxis(ALAxis.Horizontal, followButton);
            followProgress.AutoAlignAxis(ALAxis.Vertical, followButton);
//#if DEBUG
            balanceImage.AutoSetDimensionsToSize(new CGSize(10, 10));
            balanceImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, mainMargin);
            balanceImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balanceLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, balanceImage, 20);
            balanceLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balanceArrow.AutoSetDimensionsToSize(new CGSize(6, 10));
            balanceArrow.AutoPinEdgeToSuperviewEdge(ALEdge.Right, mainMargin);
            balanceArrow.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balance.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 55);
            balance.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
//#endif
            firstSpacing.AutoSetDimension(ALDimension.Width, 48);
            secondSpacing.AutoSetDimension(ALDimension.Width, 48);

            #endregion

            return(this);
        }
Пример #5
0
        public CustomAlertView Create(Post post, UINavigationController controller, UIView view)
        {
            _pickedCoin = CurrencyType.Steem;
            _coins      = new List <CurrencyType>();
            switch (AppSettings.User.Chain)
            {
            case KnownChains.Steem:
                _coins.AddRange(new[] { CurrencyType.Steem, CurrencyType.Sbd });
                break;

            case KnownChains.Golos:
                _coins.AddRange(new[] { CurrencyType.Golos, CurrencyType.Gbg });
                break;
            }

            var popup = new UIView();

            popup.ClipsToBounds      = true;
            popup.Layer.CornerRadius = 20;
            popup.BackgroundColor    = Constants.R255G255B255;

            var _alert = new CustomAlertView(popup, controller);

            var dialogWidth = UIScreen.MainScreen.Bounds.Width - 10 * 2;

            popup.AutoSetDimension(ALDimension.Width, dialogWidth);

            var commonMargin = 20;

            var title = new UILabel();

            title.Font          = Constants.Semibold14;
            title.Text          = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromotePost);
            title.TextAlignment = UITextAlignment.Center;
            popup.AddSubview(title);
            title.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            title.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            title.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            title.AutoSetDimension(ALDimension.Height, 70);

            var topSeparator = new UIView();

            topSeparator.BackgroundColor = Constants.R245G245B245;
            popup.AddSubview(topSeparator);

            topSeparator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, title);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
            topSeparator.AutoSetDimension(ALDimension.Height, 1);

            var container = new UIView();

            popup.AddSubview(container);

            container.AutoSetDimension(ALDimension.Height, 142);
            container.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, topSeparator);
            container.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
            container.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);

            var promotionLabel = new UILabel();

            promotionLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Amount);
            promotionLabel.Font = Constants.Semibold14;

            container.AddSubview(promotionLabel);

            promotionLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 27);
            promotionLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left);

            balanceLoader = new UIActivityIndicatorView();
            balanceLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            balanceLoader.Color            = UIColor.Black;
            balanceLoader.HidesWhenStopped = true;
            balanceLoader.StartAnimating();

            container.AddSubview(balanceLoader);

            balanceLoader.AutoPinEdge(ALEdge.Left, ALEdge.Right, promotionLabel, 10);
            balanceLoader.AutoAlignAxis(ALAxis.Horizontal, promotionLabel);

            balanceLabel               = new UILabel();
            balanceLabel.Font          = Constants.Semibold14;
            balanceLabel.TextColor     = Constants.R151G155B158;
            balanceLabel.TextAlignment = UITextAlignment.Right;

            container.AddSubview(balanceLabel);

            balanceLabel.AutoAlignAxis(ALAxis.Horizontal, promotionLabel);
            balanceLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            balanceLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, promotionLabel, 5);
            balanceLabel.SetContentHuggingPriority(1, UILayoutConstraintAxis.Horizontal);

            GetBalance();

            var rightView = new UIView();

            container.AddSubview(rightView);
            rightView.AutoSetDimension(ALDimension.Height, 50);

            UIImageView pickerImage = new UIImageView(UIImage.FromBundle("ic_currency_picker.png"));

            rightView.AddSubview(pickerImage);
            pickerImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            pickerImage.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);

            UILabel _pickerLabel = new UILabel();

            _pickerLabel.Text          = "STEEM";
            _pickerLabel.TextAlignment = UITextAlignment.Center;
            _pickerLabel.Font          = Constants.Semibold14;
            _pickerLabel.TextColor     = Constants.R255G71B5;
            rightView.AddSubview(_pickerLabel);
            _pickerLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            _pickerLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _pickerLabel.AutoPinEdge(ALEdge.Right, ALEdge.Left, pickerImage, -5);

            rightView.LayoutIfNeeded();

            _amountTextField = new SearchTextField(AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferAmountHint),
                                                   new UIEdgeInsets(0, 20, 0, 0), new AmountFieldDelegate(), false, rightView);
            _amountTextField.KeyboardType       = UIKeyboardType.DecimalPad;
            _amountTextField.Layer.CornerRadius = 25;
            container.AddSubview(_amountTextField);

            _amountTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _amountTextField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, promotionLabel, 16);
            _amountTextField.AutoSetDimension(ALDimension.Height, 50);

            errorMessage           = new UILabel();
            errorMessage.Font      = Constants.Semibold14;
            errorMessage.TextColor = Constants.R255G34B5;
            container.AddSubview(errorMessage);

            errorMessage.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _amountTextField);
            errorMessage.AutoPinEdge(ALEdge.Left, ALEdge.Left, _amountTextField);
            errorMessage.AutoPinEdge(ALEdge.Right, ALEdge.Right, _amountTextField);

            _amountTextField.EditingChanged += IsEnoughBalance;
            var max = new UIButton();

            max.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Max), UIControlState.Normal);
            max.SetTitleColor(UIColor.Black, UIControlState.Normal);
            max.Font = Constants.Semibold14;
            max.Layer.BorderWidth  = 1;
            max.Layer.BorderColor  = Constants.R245G245B245.CGColor;
            max.Layer.CornerRadius = 25;

            container.AddSubview(max);

            max.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            max.AutoPinEdge(ALEdge.Left, ALEdge.Right, _amountTextField, 10);
            max.AutoSetDimensionsToSize(new CGSize(80, 50));
            max.AutoAlignAxis(ALAxis.Horizontal, _amountTextField);
            max.TouchDown += MaxBtnOnClick;

            rightView.AutoAlignAxis(ALAxis.Horizontal, _amountTextField);
            rightView.AutoPinEdge(ALEdge.Right, ALEdge.Right, _amountTextField);
            container.BringSubviewToFront(rightView);

            UIPickerView picker = new UIPickerView();

            picker.Select(_coins.IndexOf(_pickedCoin), 0, true);
            picker.Model           = new CoinPickerViewModel(_coins);
            picker.BackgroundColor = Constants.R255G255B255;
            popup.AddSubview(picker);

            picker.AutoMatchDimension(ALDimension.Height, ALDimension.Height, container);
            picker.AutoMatchDimension(ALDimension.Width, ALDimension.Width, container);
            picker.AutoPinEdge(ALEdge.Top, ALEdge.Top, container);
            var pickerHidden  = picker.AutoPinEdge(ALEdge.Right, ALEdge.Left, container, -20);
            var pickerVisible = picker.AutoPinEdge(ALEdge.Right, ALEdge.Right, container);

            pickerVisible.Active = false;

            var promoteContainer = new UIView();

            promoteContainer.BackgroundColor = Constants.R255G255B255;
            popup.AddSubview(promoteContainer);

            promoteContainer.AutoMatchDimension(ALDimension.Height, ALDimension.Height, container);
            promoteContainer.AutoMatchDimension(ALDimension.Width, ALDimension.Width, container);
            promoteContainer.AutoPinEdge(ALEdge.Top, ALEdge.Top, container);
            var promoteHidden  = promoteContainer.AutoPinEdge(ALEdge.Left, ALEdge.Right, container, 20);
            var promoteVisible = promoteContainer.AutoPinEdge(ALEdge.Left, ALEdge.Left, container);

            promoteVisible.Active = false;

            var avatar = new UIImageView();

            avatar.Layer.CornerRadius = 20;
            avatar.ClipsToBounds      = true;
            promoteContainer.AddSubview(avatar);

            avatar.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 16);
            avatar.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            avatar.AutoSetDimensionsToSize(new CGSize(40, 40));

            var promoterLogin = new UILabel();

            promoterLogin.Font      = Constants.Semibold14;
            promoterLogin.TextColor = Constants.R255G34B5;
            promoteContainer.AddSubview(promoterLogin);

            promoterLogin.AutoPinEdge(ALEdge.Left, ALEdge.Right, avatar, 20);
            promoterLogin.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            promoterLogin.AutoAlignAxis(ALAxis.Horizontal, avatar);

            var expectedTimeBackground = new UIView();

            expectedTimeBackground.Layer.CornerRadius = 10;
            expectedTimeBackground.BackgroundColor    = Constants.R250G250B250;
            promoteContainer.AddSubview(expectedTimeBackground);

            expectedTimeBackground.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, avatar, 15);
            expectedTimeBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            expectedTimeBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            expectedTimeBackground.AutoSetDimension(ALDimension.Height, 50);

            var expectedTimeLabel = new UILabel();

            expectedTimeLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.ExpectedVoteTime);
            expectedTimeLabel.Font = Constants.Regular14;
            expectedTimeBackground.AddSubview(expectedTimeLabel);

            expectedTimeLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, DeviceHelper.IsSmallDevice ? 10 : 20);
            expectedTimeLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            var expectedTimeValue = new UILabel();

            expectedTimeValue.TextAlignment = UITextAlignment.Right;
            expectedTimeValue.Font          = Constants.Light20;
            expectedTimeBackground.AddSubview(expectedTimeValue);

            expectedTimeValue.AutoPinEdge(ALEdge.Left, ALEdge.Right, expectedTimeLabel);
            expectedTimeValue.AutoPinEdgeToSuperviewEdge(ALEdge.Right, DeviceHelper.IsSmallDevice ? 10 : 20);
            expectedTimeValue.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            var sureText = new UILabel();

            sureText.BackgroundColor = Constants.R255G255B255;
            sureText.Lines           = 4;
            sureText.TextAlignment   = UITextAlignment.Center;
            sureText.Font            = Constants.Regular20;
            popup.AddSubview(sureText);

            sureText.AutoMatchDimension(ALDimension.Height, ALDimension.Height, container);
            sureText.AutoMatchDimension(ALDimension.Width, ALDimension.Width, container);
            sureText.AutoPinEdge(ALEdge.Top, ALEdge.Top, container);
            var sureTextHidden  = sureText.AutoPinEdge(ALEdge.Left, ALEdge.Right, container, 20);
            var sureTextVisible = sureText.AutoPinEdge(ALEdge.Left, ALEdge.Left, container);

            sureTextVisible.Active = false;

            var completeText = new UILabel();

            completeText.BackgroundColor = Constants.R255G255B255;
            completeText.Lines           = 4;
            completeText.TextAlignment   = UITextAlignment.Center;
            completeText.Font            = Constants.Regular20;
            popup.AddSubview(completeText);

            completeText.AutoMatchDimension(ALDimension.Height, ALDimension.Height, container);
            completeText.AutoMatchDimension(ALDimension.Width, ALDimension.Width, container);
            completeText.AutoPinEdge(ALEdge.Top, ALEdge.Top, container);
            var completeTextHidden  = completeText.AutoPinEdge(ALEdge.Left, ALEdge.Right, container, 20);
            var completeTextVisible = completeText.AutoPinEdge(ALEdge.Left, ALEdge.Left, container);

            completeTextVisible.Active = false;

            var separator = new UIView();

            separator.BackgroundColor = Constants.R245G245B245;
            popup.AddSubview(separator);

            separator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, container);
            separator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
            separator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
            separator.AutoSetDimension(ALDimension.Height, 1);

            var selectButton = new UIButton();

            selectButton.SetTitle(string.Empty, UIControlState.Disabled);
            selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.FindPromoter), UIControlState.Normal);
            selectButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            selectButton.Layer.CornerRadius = 25;
            selectButton.Font = Constants.Bold14;
            popup.AddSubview(selectButton);

            selectButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, separator, 20);
            selectButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
            selectButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
            selectButton.AutoSetDimension(ALDimension.Height, 50);
            selectButton.LayoutIfNeeded();

            var loader = new UIActivityIndicatorView();

            loader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            loader.HidesWhenStopped           = true;

            selectButton.AddSubview(loader);

            loader.AutoCenterInSuperview();

            var tap = new UITapGestureRecognizer(() =>
            {
                if (balances == null)
                {
                    return;
                }

                _amountTextField.ResignFirstResponder();
                pickerHidden.Active  = false;
                pickerVisible.Active = true;

                UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    popup.LayoutIfNeeded();
                }, () =>
                {
                    title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.SelectToken);
                    selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Select), UIControlState.Normal);
                });
            });

            rightView.AddGestureRecognizer(tap);

            var cancelButton = new UIButton();

            cancelButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Close), UIControlState.Normal);
            cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            cancelButton.Layer.CornerRadius = 25;
            cancelButton.Font = Constants.Semibold14;
            cancelButton.Layer.BorderWidth = 1;
            cancelButton.Layer.BorderColor = Constants.R245G245B245.CGColor;
            popup.AddSubview(cancelButton);

            cancelButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, selectButton, 20);
            cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
            cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
            cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, commonMargin);
            cancelButton.AutoSetDimension(ALDimension.Height, 50);

            controller.View.EndEditing(true);

            Timer timer = null;

            OperationResult <PromoteResponse> promoter = null;

            selectButton.TouchDown += async(sender, e) =>
            {
                if (balanceLoader.IsAnimating)
                {
                    return;
                }

                IsEnoughBalance(null, null);

                if (pickerVisible.Active)
                {
                    _pickedCoin       = _coins[(int)picker.SelectedRowInComponent(0)];
                    _pickerLabel.Text = _pickedCoin.ToString().ToUpper();

                    var balance = balances?.Find(x => x.CurrencyType == _pickedCoin);
                    balanceLabel.Text = $"{AppSettings.LocalizationManager.GetText(LocalizationKeys.Balance)}: {balance?.Value}";

                    pickerHidden.Active  = true;
                    pickerVisible.Active = false;
                    UIView.Animate(0.5, () =>
                    {
                        popup.LayoutIfNeeded();
                    }, () =>
                    {
                        title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromotePost);
                        selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.FindPromoter), UIControlState.Normal);
                        _amountTextField.UpdateRightViewRect();
                    });
                }
                else if (sureTextVisible.Active)
                {
                    if (!AppSettings.User.HasActivePermission)
                    {
                        _alert.Hidden = true;

                        controller.PushViewController(new LoginViewController(false), true);
                        return;
                    }

                    selectButton.Enabled = false;
                    loader.StartAnimating();

                    sureTextHidden.Active  = true;
                    sureTextVisible.Active = false;

                    var transferResponse = await _presenter.TryTransfer(AppSettings.User.UserInfo, promoter.Result.Bot.Author, _amountTextField.GetDoubleValue().ToString(), _pickedCoin, $"https://steemit.com{post.Url}");

                    if (transferResponse.IsSuccess)
                    {
                        completeText.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.SuccessPromote);
                    }
                    else
                    {
                        completeText.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.TokenTransferError);
                    }

                    completeTextHidden.Active  = false;
                    completeTextVisible.Active = true;

                    UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                    {
                        popup.LayoutIfNeeded();
                    }, () =>
                    {
                        selectButton.Enabled = true;
                        loader.StopAnimating();
                        title.Text = true ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoteComplete) : AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferError);
                        selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoteAgain), UIControlState.Normal);

                        promoteVisible.Active = false;
                        promoteHidden.Active  = true;
                        popup.LayoutIfNeeded();
                        timer?.Dispose();
                    });
                }
                else if (promoteVisible.Active)
                {
                    var promoteConfirmation = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoteConfirmation,
                                                                                      _amountTextField.GetDoubleValue().ToString(),
                                                                                      _pickedCoin == CurrencyType.Sbd ? "SBD" : "Steem",
                                                                                      promoter.Result.Bot.Author);

                    sureText.Text          = promoteConfirmation;
                    sureTextHidden.Active  = false;
                    sureTextVisible.Active = true;

                    UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                    {
                        popup.LayoutIfNeeded();
                    }, () =>
                    {
                        selectButton.SetTitle("Yes", UIControlState.Normal);
                    });
                }
                else if (completeTextVisible.Active)
                {
                    completeTextHidden.Active  = true;
                    completeTextVisible.Active = false;

                    UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                    {
                        popup.LayoutIfNeeded();
                    }, () =>
                    {
                        title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromotePost);
                        selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.FindPromoter), UIControlState.Normal);
                    });
                }
                else
                {
                    if (_amountTextField.GetDoubleValue() > balances?.Find(x => x.CurrencyType == _pickedCoin).Value)
                    {
                        errorMessage.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.NotEnoughBalance);
                        errorMessage.Hidden = false;
                        return;
                    }

                    if (string.IsNullOrEmpty(_amountTextField.Text) || !IsValidAmount())
                    {
                        return;
                    }

                    selectButton.Enabled = false;
                    loader.StartAnimating();

                    var pr = new PromoteRequest()
                    {
                        Amount        = _amountTextField.GetDoubleValue(),
                        CurrencyType  = _pickedCoin,
                        PostToPromote = post,
                    };

                    promoter = await _presenter.FindPromoteBot(pr);

                    if (promoter.IsSuccess)
                    {
                        var expectedUpvoteTime = promoter.Result.ExpectedUpvoteTime;
                        if (expectedUpvoteTime.ToString().Length > 8)
                        {
                            expectedTimeValue.Text = expectedUpvoteTime.ToString().Remove(8);
                        }
                        timer = new Timer((obj) =>
                        {
                            expectedUpvoteTime = expectedUpvoteTime.Subtract(TimeSpan.FromSeconds(1));
                            view.InvokeOnMainThread(() =>
                            {
                                if (expectedUpvoteTime.ToString().Length > 8)
                                {
                                    expectedTimeValue.Text = expectedUpvoteTime.ToString().Remove(8);
                                }
                                else
                                {
                                    expectedTimeValue.Text = expectedUpvoteTime.ToString();
                                }
                            });
                        }, null, DateTime.Now.Add(expectedUpvoteTime).Millisecond, (int)TimeSpan.FromSeconds(1).TotalMilliseconds);

                        promoterLogin.Text = $"@{promoter.Result.Bot.Author}";

                        if (!string.IsNullOrEmpty(promoter.Result.Bot.Avatar))
                        {
                            ImageLoader.Load(promoter.Result.Bot.Avatar, avatar, size: new CGSize(300, 300));
                        }
                        else
                        {
                            avatar.Image = UIImage.FromBundle("ic_noavatar");
                        }

                        promoteHidden.Active  = false;
                        promoteVisible.Active = true;
                        UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                        {
                            popup.LayoutIfNeeded();
                        }, () =>
                        {
                            selectButton.Enabled = true;
                            loader.StopAnimating();
                            title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoterFound);
                            selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Promote), UIControlState.Normal);
                        });
                    }
                    else
                    {
                        completeText.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoterNotFound);

                        completeTextHidden.Active  = false;
                        completeTextVisible.Active = true;

                        UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                        {
                            popup.LayoutIfNeeded();
                        }, () =>
                        {
                            selectButton.Enabled = true;
                            loader.StopAnimating();
                            title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PromoterSearchResult);
                            selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.SearchAgain), UIControlState.Normal);
                        });
                    }
                }
            };
            cancelButton.TouchDown += (sender, e) =>
            {
                _alert.Close();
            };

            var popuptap = new UITapGestureRecognizer(() =>
            {
                _amountTextField.ResignFirstResponder();
            });

            popup.AddGestureRecognizer(popuptap);

            Constants.CreateGradient(selectButton, 25);
            Constants.CreateShadowFromZeplin(selectButton, Constants.R231G72B0, 0.3f, 0, 10, 20, 0);
            popup.BringSubviewToFront(selectButton);

            _alert.Show();

            return(_alert);
        }
Пример #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            _closeButton = new UIButton();
            _closeButton.SetTitle("Close", UIControlState.Normal);
            _closeButton.Font = Constants.Semibold14;
            _closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            _closeButton.Layer.BorderWidth  = 1;
            _closeButton.Layer.BorderColor  = Constants.R244G244B246.CGColor;
            _closeButton.Layer.CornerRadius = 25;
            _closeButton.TouchDown         += CloseView;
            View.Add(_closeButton);

            if (DeviceHelper.IsSmallDevice)
            {
                _closeButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 10);
            }
            else
            {
                _closeButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 64);
            }
            _closeButton.AutoSetDimension(ALDimension.Height, 50);
            _closeButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            _closeButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);

            _resendEmail = new UIButton();
            _resendEmail.SetTitle("Resend email", UIControlState.Normal);
            _resendEmail.SetTitleColor(UIColor.Clear, UIControlState.Disabled);
            Constants.CreateShadow(_resendEmail, Constants.R231G72B0, 0.5f, 25, 10, 12);
            _resendEmail.Font       = Constants.Bold14;
            _resendEmail.TouchDown += ResendEmail;
            View.Add(_resendEmail);

            _resendEmail.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _closeButton, -20);
            _resendEmail.AutoSetDimension(ALDimension.Height, 50);
            _resendEmail.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            _resendEmail.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);

            _loader                  = new UIActivityIndicatorView();
            _loader.Color            = UIColor.White;
            _loader.HidesWhenStopped = true;

            View.AddSubview(_loader);

            _loader.AutoAlignAxis(ALAxis.Horizontal, _resendEmail);
            _loader.AutoAlignAxis(ALAxis.Vertical, _resendEmail);

            var outerView = new UIView();

            View.AddSubview(outerView);

            outerView.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _resendEmail);
            outerView.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            outerView.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            outerView.AutoPinEdgeToSuperviewEdge(ALEdge.Left);

            var innerView = new UIView();

            outerView.AddSubview(innerView);

            innerView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 30);
            innerView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30);
            innerView.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            var image = new UIImageView();

            image.Image       = UIImage.FromBundle("ic_email");
            image.ContentMode = UIViewContentMode.ScaleAspectFit;
            innerView.AddSubview(image);

            image.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            image.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 27);
            image.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 27);

            var label = new UILabel();

            label.Text = "A letter with a password will be send to the email you specified.";
            if (DeviceHelper.IsSmallDevice)
            {
                label.Font = Constants.Light23;
            }
            else
            {
                label.Font = Constants.Light23;
            }
            label.Lines         = 10;
            label.TextAlignment = UITextAlignment.Center;
            label.TextColor     = Constants.R15G24B30;

            innerView.AddSubview(label);

            label.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            label.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            label.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            if (DeviceHelper.IsSmallDevice)
            {
                label.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, image, 25);
            }
            else
            {
                label.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, image, 50);
            }

            NavigationController.SetNavigationBarHidden(true, true);
        }
Пример #7
0
        private void CreateView()
        {
            View.BackgroundColor = UIColor.White;
            searchTextField      = new SearchTextField("Tap to search");
            searchTextField.ReturnButtonTapped += ShouldReturn;
            searchTextField.BecomeFirstResponder();
            //searchTextField.Font = Constants.Regular14;
            View.AddSubview(searchTextField);

            searchTextField.ClearButtonTapped += () => { OnTimer(null); };
            searchTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 10f);
            searchTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15f);
            searchTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15f);
            searchTextField.AutoSetDimension(ALDimension.Height, 40f);

            tagsButton = new UIButton();
            tagsButton.SetTitle("Tag", UIControlState.Normal);
            tagsButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            tagsButton.SetTitleColor(Constants.R255G34B5, UIControlState.Selected);
            tagsButton.Font = Constants.Semibold14;

            peopleButton = new UIButton();
            peopleButton.SetTitle("User", UIControlState.Normal);
            peopleButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            peopleButton.SetTitleColor(Constants.R255G34B5, UIControlState.Selected);
            peopleButton.Font = Constants.Semibold14;

            View.AddSubviews(new[] { tagsButton, peopleButton });

            tagsButton.AutoSetDimension(ALDimension.Height, 50f);
            tagsButton.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width / 2);
            tagsButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            tagsButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, searchTextField);

            peopleButton.AutoSetDimension(ALDimension.Height, 50f);
            peopleButton.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width / 2);
            peopleButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            peopleButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, searchTextField);

            var underline = new UIView();

            underline.BackgroundColor = Constants.R245G245B245;
            View.AddSubview(underline);

            underline.AutoSetDimension(ALDimension.Height, 1f);
            underline.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            underline.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            underline.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, tagsButton, 1);

            var selectedUnderline = new UIView();

            selectedUnderline.BackgroundColor = Constants.R255G34B5;
            View.AddSubview(selectedUnderline);

            selectedUnderline.AutoSetDimension(ALDimension.Height, 2f);
            selectedUnderline.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width / 2);
            selectedUnderline.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, tagsButton);

            pinToTags          = selectedUnderline.AutoPinEdge(ALEdge.Left, ALEdge.Left, tagsButton);
            pinToPeople        = selectedUnderline.AutoPinEdge(ALEdge.Left, ALEdge.Left, peopleButton);
            pinToPeople.Active = false;

            tagsTable = new UITableView();
            View.AddSubview(tagsTable);

            tagsTable.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, underline);
            tagTableVisible       = tagsTable.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30);
            tagTableHidden        = tagsTable.AutoPinEdge(ALEdge.Right, ALEdge.Left, View, -30);
            tagTableHidden.Active = false;
            tagsTable.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width - 60);
            tagsTable.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            usersTable = new UITableView();
            View.AddSubview(usersTable);

            usersTable.AutoPinEdge(ALEdge.Top, ALEdge.Top, tagsTable);
            usersTable.AutoPinEdge(ALEdge.Left, ALEdge.Right, tagsTable, 30);
            usersTable.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width);
            usersTable.AutoPinEdge(ALEdge.Bottom, ALEdge.Bottom, tagsTable);

            CreateNoResultView(_noResultViewTags, tagsTable);

            _noResultViewTags.AutoPinEdge(ALEdge.Right, ALEdge.Right, tagsTable, 12);
            _noResultViewTags.AutoPinEdge(ALEdge.Left, ALEdge.Left, tagsTable, -12);
            _tagsNotFoundHorizontalAlignment = _noResultViewTags.AutoAlignAxis(ALAxis.Horizontal, tagsTable);

            CreateNoResultView(_noResultViewPeople, usersTable);
            _noResultViewPeople.AutoPinEdge(ALEdge.Right, ALEdge.Right, usersTable, -18);
            _noResultViewPeople.AutoPinEdge(ALEdge.Left, ALEdge.Left, usersTable, 18);
            _peopleNotFoundHorizontalAlignment = _noResultViewPeople.AutoAlignAxis(ALAxis.Horizontal, usersTable);

            _tagsLoader = new UIActivityIndicatorView();
            _tagsLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            _tagsLoader.Color            = Constants.R231G72B0;
            _tagsLoader.HidesWhenStopped = true;
            _tagsLoader.StopAnimating();
            View.AddSubview(_tagsLoader);

            _tagsHorizontalAlignment = _tagsLoader.AutoAlignAxis(ALAxis.Horizontal, tagsTable);
            _tagsLoader.AutoAlignAxis(ALAxis.Vertical, tagsTable);

            _peopleLoader = new UIActivityIndicatorView();
            _peopleLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            _peopleLoader.Color            = Constants.R231G72B0;
            _peopleLoader.HidesWhenStopped = true;
            _peopleLoader.StopAnimating();
            View.AddSubview(_peopleLoader);

            _peopleHorizontalAlignment = _peopleLoader.AutoAlignAxis(ALAxis.Horizontal, usersTable);
            _peopleLoader.AutoAlignAxis(ALAxis.Vertical, usersTable);

            warningView = new UIView();
            warningView.ClipsToBounds   = true;
            warningView.BackgroundColor = Constants.R255G34B5;
            warningView.Alpha           = 0;
            Constants.CreateShadow(warningView, Constants.R231G72B0, 0.5f, 6, 10, 12);
            View.AddSubview(warningView);

            warningView.AutoSetDimension(ALDimension.Height, 60);
            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            warningViewToBottomConstraint = warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            var warningImage = new UIImageView();

            warningImage.Image = UIImage.FromBundle("ic_info");

            var warningLabel = new UILabel();

            warningLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.TagSearchWarning);
            warningLabel.Lines     = 3;
            warningLabel.Font      = Constants.Regular12;
            warningLabel.TextColor = UIColor.FromRGB(255, 255, 255);

            warningView.AddSubview(warningLabel);
            warningView.AddSubview(warningImage);

            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 20);
            warningImage.AutoSetDimension(ALDimension.Width, 20);
            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 20);

            warningLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, warningImage, 20);
            warningLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            warningLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);

            var tap = new UITapGestureRecognizer(() =>
            {
                searchTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(tap);
        }
Пример #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            var tapGesture = new UITapGestureRecognizer(() =>
            {
                _email.ResignFirstResponder();
                _username.ResignFirstResponder();
            });

            View.AddGestureRecognizer(tapGesture);
            View.UserInteractionEnabled = true;

            _timer       = new Timer(OnTimer);
            _mailChecker = new StringHelper();

            _createAcc = new UIButton();
            _createAcc.SetTitle("Create account", UIControlState.Normal);
            _createAcc.SetTitleColor(UIColor.Clear, UIControlState.Disabled);
            Constants.CreateShadow(_createAcc, Constants.R231G72B0, 0.5f, 25, 10, 12);
            _createAcc.Font       = Constants.Bold14;
            _createAcc.TouchDown += CreateAccount;
            View.Add(_createAcc);

            _createAcc.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            _createAcc.AutoSetDimension(ALDimension.Height, 50);
            _createAcc.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            _createAcc.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);

            _emailUnderline = new UIView();
            _emailUnderline.BackgroundColor = UIColor.FromRGB(240, 240, 240);
            View.AddSubview(_emailUnderline);

            _emailUnderline.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _createAcc, -50);
            _emailUnderline.AutoSetDimension(ALDimension.Height, 1);
            _emailUnderline.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 35);
            _emailUnderline.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 35);

            _emailLabel           = new UILabel();
            _emailLabel.TextColor = Constants.R255G34B5;
            _emailLabel.Text      = "invalid email";
            _emailLabel.Font      = Constants.Semibold12;
            _emailLabel.Hidden    = true;
            View.AddSubview(_emailLabel);

            _emailLabel.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _emailUnderline);
            _emailLabel.AutoPinEdge(ALEdge.Right, ALEdge.Right, _emailUnderline);

            _email = new UITextField();
            var emailDelegate = new BaseTextFieldDelegate();

            _email.Delegate           = emailDelegate;
            emailDelegate.DoneTapped += () =>
            {
                _email.ResignFirstResponder();
                CreateAccount(null, null);
            };
            _email.Placeholder            = "Email address";
            _email.KeyboardType           = UIKeyboardType.EmailAddress;
            _email.AutocorrectionType     = UITextAutocorrectionType.No;
            _email.AutocapitalizationType = UITextAutocapitalizationType.None;
            _email.TextAlignment          = UITextAlignment.Center;
            _email.ReturnKeyType          = UIReturnKeyType.Go;
            _email.EditingChanged        += CheckMail;

            View.AddSubview(_email);

            _email.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _emailUnderline, -7);
            _email.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 35);
            _email.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 35);
            _email.AutoSetDimension(ALDimension.Height, 30);

            _usernameUnderline = new UIView();
            _usernameUnderline.BackgroundColor = Constants.R240G240B240;
            View.AddSubview(_usernameUnderline);

            _usernameUnderline.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _email, -35);
            _usernameUnderline.AutoSetDimension(ALDimension.Height, 1);
            _usernameUnderline.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 35);
            _usernameUnderline.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 35);

            _usernameLabel           = new UILabel();
            _usernameLabel.TextColor = Constants.R255G34B5;
            _usernameLabel.Text      = "username already taken";
            _usernameLabel.Font      = Constants.Semibold12;
            _usernameLabel.Hidden    = true;
            View.AddSubview(_usernameLabel);

            _usernameLabel.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _usernameUnderline);
            _usernameLabel.AutoPinEdge(ALEdge.Right, ALEdge.Right, _usernameUnderline);

            _username = new UITextField();
            var usernameDelegate = new UsernameDelegate();

            _username.Delegate           = usernameDelegate;
            usernameDelegate.DoneTapped += () =>
            {
                _email.BecomeFirstResponder();
            };
            _username.Placeholder            = "Username";
            _username.AutocorrectionType     = UITextAutocorrectionType.No;
            _username.AutocapitalizationType = UITextAutocapitalizationType.None;
            _username.TextAlignment          = UITextAlignment.Center;
            _username.ReturnKeyType          = UIReturnKeyType.Next;
            _username.EditingChanged        += (object sender, EventArgs e) =>
            {
                if (string.IsNullOrEmpty(_username.Text))
                {
                    _presenter.TasksCancel();
                    _timer.Change(Timeout.Infinite, Timeout.Infinite);
                    _usernameUnderline.BackgroundColor = Constants.R240G240B240;
                    _usernameLabel.Hidden = true;
                }
                else
                {
                    _timer.Change(1300, Timeout.Infinite);
                }
            };
            View.AddSubview(_username);

            _username.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _usernameUnderline, -7);
            _username.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 35);
            _username.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 35);
            _username.AutoSetDimension(ALDimension.Height, 30);

            _loader                  = new UIActivityIndicatorView();
            _loader.Color            = Constants.R231G72B0;
            _loader.HidesWhenStopped = true;

            View.AddSubview(_loader);

            _loader.AutoPinEdge(ALEdge.Left, ALEdge.Right, _username);
            _loader.AutoAlignAxis(ALAxis.Horizontal, _username);

            _registrationLoader                  = new UIActivityIndicatorView();
            _registrationLoader.Color            = UIColor.White;
            _registrationLoader.HidesWhenStopped = true;

            View.AddSubview(_registrationLoader);

            _registrationLoader.AutoAlignAxis(ALAxis.Horizontal, _createAcc);
            _registrationLoader.AutoAlignAxis(ALAxis.Vertical, _createAcc);

            SetBackButton();
        }
        private void CreateView()
        {
            View.BackgroundColor = UIColor.White;

            UILabel recepientLabel = new UILabel();

            recepientLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.RecipientName);
            recepientLabel.Font      = Constants.Semibold14;
            recepientLabel.TextColor = UIColor.Black;
            View.AddSubview(recepientLabel);

            recepientLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 25);
            recepientLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);

            var recipientStackView = new UIStackView();

            recipientStackView.Spacing = 10;
            View.AddSubview(recipientStackView);

            recipientStackView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            recipientStackView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, recepientLabel, 16);
            recipientStackView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            recipientStackView.AutoSetDimension(ALDimension.Height, 50);

            _recipientAvatar = new UIImageView();
            _recipientAvatar.Layer.CornerRadius = 25;
            _recipientAvatar.ClipsToBounds      = true;
            _recipientAvatar.Hidden             = true;
            recipientStackView.AddArrangedSubview(_recipientAvatar);
            _recipientAvatar.AutoSetDimension(ALDimension.Width, 50);

            _recepientTextField = new SearchTextField(AppSettings.LocalizationManager.GetText(LocalizationKeys.RecipientNameHint));

            _recepientTextField.ReturnButtonTapped += () => {
                RemoveFocus();
            };

            _recepientTextField.EditingChanged    += EditingChanged;
            _recepientTextField.Layer.CornerRadius = 25;
            _recepientTextField.EditingChanged    += (object sender, EventArgs e) =>
            {
                _transferFacade.Recipient = null;
            };

            recipientStackView.AddArrangedSubview(_recepientTextField);

            _recepientTextField.EditingDidBegin += (object sender, EventArgs e) =>
            {
                _usersTable.Hidden = false;
            };

            _recepientTextField.EditingDidEnd += (object sender, EventArgs e) =>
            {
                _usersTable.Hidden = true;
                _usersLoader.StopAnimating();
                _noResultViewTags.Hidden = true;
            };

            _recepientTextField.ClearButtonTapped += () =>
            {
                UIView.Animate(0.2, () =>
                {
                    _recipientAvatar.Hidden = true;
                    _recipientAvatar.LayoutIfNeeded();
                });

                _prevQuery = string.Empty;
                _transferFacade.Recipient = null;
                _transferFacade.UserFriendPresenter.Clear();
                _recepientTextField.Text = _transferFacade?.Recipient?.Author;
            };

            UILabel amountLabel = new UILabel();

            amountLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferAmount);
            amountLabel.Font      = Constants.Semibold14;
            amountLabel.TextColor = UIColor.Black;
            View.AddSubview(amountLabel);

            amountLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            amountLabel.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, recipientStackView, 25);

            _balanceLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            _balanceLoader.Color            = UIColor.Black;
            _balanceLoader.HidesWhenStopped = true;
            _balanceLoader.StartAnimating();

            View.AddSubview(_balanceLoader);

            _balanceLoader.AutoPinEdge(ALEdge.Left, ALEdge.Right, amountLabel, 10);
            _balanceLoader.AutoAlignAxis(ALAxis.Horizontal, amountLabel);

            _balanceLabel               = new UILabel();
            _balanceLabel.Font          = Constants.Semibold14;
            _balanceLabel.TextColor     = Constants.R151G155B158;
            _balanceLabel.TextAlignment = UITextAlignment.Right;

            View.AddSubview(_balanceLabel);

            _balanceLabel.AutoAlignAxis(ALAxis.Horizontal, amountLabel);
            _balanceLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, amountLabel, 5);
            _balanceLabel.SetContentHuggingPriority(1, UILayoutConstraintAxis.Horizontal);

            var rightView = new UIView();

            View.AddSubview(rightView);
            rightView.AutoSetDimension(ALDimension.Height, 50);

            UIImageView pickerImage = new UIImageView(UIImage.FromBundle("ic_currency_picker.png"));

            rightView.AddSubview(pickerImage);
            pickerImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            pickerImage.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);

            _pickerLabel.Text          = "STEEM";
            _pickerLabel.TextAlignment = UITextAlignment.Center;
            _pickerLabel.Font          = Constants.Semibold14;
            _pickerLabel.TextColor     = Constants.R255G71B5;
            rightView.AddSubview(_pickerLabel);
            _pickerLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            _pickerLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _pickerLabel.AutoPinEdge(ALEdge.Right, ALEdge.Left, pickerImage, -5);

            rightView.LayoutIfNeeded();

            _amountTextField = new SearchTextField(AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferAmountHint),
                                                   new UIEdgeInsets(0, 20, 0, 0), new AmountFieldDelegate(), false, rightView);

            _amountTextField.KeyboardType       = UIKeyboardType.DecimalPad;
            _amountTextField.Layer.CornerRadius = 25;
            View.AddSubview(_amountTextField);

            //_amountTextField.ClearButtonTapped += () => { };
            _amountTextField.EditingChanged += IsEnoughBalance;

            View.AddSubview(_amountTextField);

            _amountTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            _amountTextField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, amountLabel, 16);
            _amountTextField.AutoSetDimension(ALDimension.Height, 50);

            var max = new UIButton();

            max.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Max), UIControlState.Normal);
            max.SetTitleColor(UIColor.Black, UIControlState.Normal);
            max.Font = Constants.Semibold14;
            max.Layer.BorderWidth  = 1;
            max.Layer.BorderColor  = Constants.R245G245B245.CGColor;
            max.Layer.CornerRadius = 25;

            View.AddSubview(max);

            max.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            max.AutoPinEdge(ALEdge.Left, ALEdge.Right, _amountTextField, 10);
            max.AutoSetDimensionsToSize(new CGSize(80, 50));
            max.AutoAlignAxis(ALAxis.Horizontal, _amountTextField);
            max.TouchDown += MaxBtnOnClick;

            rightView.AutoAlignAxis(ALAxis.Horizontal, _amountTextField);
            rightView.AutoPinEdge(ALEdge.Right, ALEdge.Right, _amountTextField);
            View.BringSubviewToFront(rightView);
            _balanceLabel.AutoPinEdge(ALEdge.Right, ALEdge.Right, _amountTextField);

            UIView pickerView = new UIView();

            pickerView.Layer.CornerRadius     = 25;
            pickerView.Layer.BorderColor      = Constants.R244G244B246.CGColor;
            pickerView.Layer.BorderWidth      = 1;
            pickerView.UserInteractionEnabled = true;
            var pickerTap = new UITapGestureRecognizer(() =>
            {
                if (_alert == null)
                {
                    var popup                = new UIView();
                    popup.ClipsToBounds      = true;
                    popup.Layer.CornerRadius = 15;
                    popup.BackgroundColor    = UIColor.White;
                    View.AddSubview(popup);
                    var dialogWidth = UIScreen.MainScreen.Bounds.Width - 10 * 2;
                    popup.AutoSetDimension(ALDimension.Width, dialogWidth);

                    var commonMargin = 20;

                    var title  = new UILabel();
                    title.Font = Constants.Semibold14;
                    title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.SelectToken);
                    title.SizeToFit();
                    popup.AddSubview(title);
                    title.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
                    title.AutoAlignAxisToSuperviewAxis(ALAxis.Vertical);
                    title.AutoSetDimension(ALDimension.Height, 70);

                    UIPickerView picker = new UIPickerView();
                    picker.Select(_coins.IndexOf(_pickedCoin), 0, true);
                    picker.Model = new CoinPickerViewModel(_coins);
                    popup.AddSubview(picker);

                    picker.AutoSetDimension(ALDimension.Width, dialogWidth - commonMargin * 2);
                    picker.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, title);
                    picker.AutoAlignAxisToSuperviewAxis(ALAxis.Vertical);
                    picker.SizeToFit();

                    var topSeparator             = new UIView();
                    topSeparator.BackgroundColor = Constants.R245G245B245;
                    popup.AddSubview(topSeparator);

                    topSeparator.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, picker);
                    topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
                    topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
                    topSeparator.AutoSetDimension(ALDimension.Height, 1);

                    var separator             = new UIView();
                    separator.BackgroundColor = Constants.R245G245B245;
                    popup.AddSubview(separator);

                    separator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, picker);
                    separator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
                    separator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
                    separator.AutoSetDimension(ALDimension.Height, 1);

                    var selectButton = new UIButton();
                    selectButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Select), UIControlState.Normal);
                    selectButton.SetTitleColor(UIColor.White, UIControlState.Normal);
                    selectButton.Layer.CornerRadius = 25;
                    selectButton.Font = Constants.Bold14;
                    popup.AddSubview(selectButton);

                    selectButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, separator, 20);
                    selectButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
                    selectButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
                    selectButton.AutoSetDimension(ALDimension.Height, 50);
                    selectButton.LayoutIfNeeded();

                    var cancelButton = new UIButton();
                    cancelButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Close), UIControlState.Normal);
                    cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
                    cancelButton.Layer.CornerRadius = 25;
                    cancelButton.Font = Constants.Semibold14;
                    cancelButton.Layer.BorderWidth = 1;
                    cancelButton.Layer.BorderColor = Constants.R245G245B245.CGColor;
                    popup.AddSubview(cancelButton);

                    cancelButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, selectButton, 20);
                    cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
                    cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
                    cancelButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, commonMargin);
                    cancelButton.AutoSetDimension(ALDimension.Height, 50);

                    NavigationController.View.EndEditing(true);

                    _alert = new CustomAlertView(popup, NavigationController);

                    selectButton.TouchDown += (sender, e) =>
                    {
                        CoinSelected(_coins[(int)picker.SelectedRowInComponent(0)]);
                        _alert.Close();
                        _amountTextField.UpdateRightViewRect();
                    };
                    cancelButton.TouchDown += (sender, e) => { _alert.Close(); };

                    popup.SizeToFit();
                    Constants.CreateGradient(selectButton, 25);
                }
                _alert.Show();
            });

            rightView.AddGestureRecognizer(pickerTap);

            var bottomStackView = new UIStackView();

            bottomStackView.Axis = UILayoutConstraintAxis.Vertical;
            View.AddSubview(bottomStackView);

            bottomStackView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            bottomStackView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _amountTextField, 5);
            bottomStackView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            bottomStackView.Spacing = 16;

            errorMessage.Font      = Constants.Semibold12;
            errorMessage.Hidden    = true;
            errorMessage.TextColor = Constants.R255G34B5;
            errorMessage.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.AmountLimitFull);
            bottomStackView.AddArrangedSubview(errorMessage);

            memoLabel           = new UILabel();
            memoLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferComment);
            memoLabel.TextColor = Constants.R255G71B5;
            memoLabel.Font      = Constants.Semibold14;
            memoLabel.UserInteractionEnabled = true;

            var memoTap = new UITapGestureRecognizer(() =>
            {
                memoLabel.TextColor = UIColor.Black;
                memoLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferComment);
                UIView.Animate(0.2, () =>
                {
                    _memoTextView.Hidden = false;
                    _memoTextView.LayoutIfNeeded();
                });
            });

            memoLabel.AddGestureRecognizer(memoTap);
            bottomStackView.AddArrangedSubview(memoLabel);

            memoLabel.AutoSetDimension(ALDimension.Height, 30);

            _memoTextView = new UITextView();
            _memoTextView.Layer.CornerRadius = 25;
            _memoTextView.TextContainerInset = new UIEdgeInsets(10, 15, 10, 15);
            _memoTextView.Font    = Constants.Regular14;
            _memoTextView.Bounces = false;
            _memoTextView.ShowsVerticalScrollIndicator = false;
            _memoTextView.Hidden          = true;
            _memoTextView.TintColor       = Constants.R255G71B5;
            _memoTextView.BackgroundColor = Constants.R245G245B245;
            _memoTextViewDelegate         = new BaseTextViewDelegate();
            _memoTextView.Delegate        = _memoTextViewDelegate;

            _memoTextViewDelegate.EditingEndedAction += () =>
            {
                base.ScrollTheView(false);
            };

            bottomStackView.AddArrangedSubview(_memoTextView);

            _memoTextView.AutoSetDimension(ALDimension.Height, 80);
            var buttonWrapper = new UIView();

            _transferButton = new UIButton();
            _transferButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _transferButton.SetTitleColor(UIColor.Clear, UIControlState.Disabled);
            _transferButton.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Transfer).ToUpper(), UIControlState.Normal);
            _transferButton.Layer.CornerRadius = 25;
            _transferButton.Font       = Constants.Bold14;
            _transferButton.TouchDown += Transfer;
            buttonWrapper.AddSubview(_transferButton);

            _transferButton.AutoSetDimension(ALDimension.Height, 50);
            _transferButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _transferButton.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 15);
            _transferButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _transferButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            Constants.CreateShadow(_transferButton, Constants.R204G204B204, 0.7f, 25, 10, 12);

            _tranfserLoader = new UIActivityIndicatorView();
            _tranfserLoader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            _tranfserLoader.HidesWhenStopped           = true;
            buttonWrapper.AddSubview(_tranfserLoader);

            _tranfserLoader.AutoAlignAxis(ALAxis.Horizontal, _transferButton);
            _tranfserLoader.AutoAlignAxis(ALAxis.Vertical, _transferButton);

            bottomStackView.AddArrangedSubview(buttonWrapper);

            buttonWrapper.AutoSetDimension(ALDimension.Height, 65);

            SetupTable();

            _noResultViewTags.Text          = AppSettings.LocalizationManager.GetText(LocalizationKeys.NoResultText);
            _noResultViewTags.Lines         = 2;
            _noResultViewTags.Hidden        = true;
            _noResultViewTags.TextAlignment = UITextAlignment.Center;
            _noResultViewTags.Font          = Constants.Light27;
            _noResultViewTags.TextColor     = Constants.R15G24B30;

            View.AddSubview(_noResultViewTags);
            _noResultViewTags.AutoPinEdge(ALEdge.Right, ALEdge.Right, _usersTable, -18);
            _noResultViewTags.AutoPinEdge(ALEdge.Left, ALEdge.Left, _usersTable, 18);
            _usersNotFoundHorizontalAlignment = _noResultViewTags.AutoAlignAxis(ALAxis.Horizontal, _usersTable);

            warningView = new UIView();
            warningView.ClipsToBounds   = true;
            warningView.BackgroundColor = Constants.R255G34B5;
            warningView.Alpha           = 0;
            Constants.CreateShadow(warningView, Constants.R231G72B0, 0.5f, 6, 10, 12);
            View.AddSubview(warningView);

            warningView.AutoSetDimension(ALDimension.Height, 60);
            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            warningViewToBottomConstraint = warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            var warningImage = new UIImageView();

            warningImage.Image = UIImage.FromBundle("ic_info");

            var warningLabel = new UILabel();

            warningLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.TagSearchWarning);
            warningLabel.Lines     = 3;
            warningLabel.Font      = Constants.Regular12;
            warningLabel.TextColor = UIColor.FromRGB(255, 255, 255);

            warningView.AddSubview(warningLabel);
            warningView.AddSubview(warningImage);

            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 20);
            warningImage.AutoSetDimension(ALDimension.Width, 20);
            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 20);

            warningLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, warningImage, 20);
            warningLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            warningLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);

            var tap = new UITapGestureRecognizer(() =>
            {
                RemoveFocus();
            });

            View.AddGestureRecognizer(tap);
        }