Exemplo n.º 1
0
        private void DecorateFollowButton()
        {
            if (!BasePresenter.User.IsAuthenticated || _currentUser.Author == BasePresenter.User.Login)
            {
                followButton.Hidden = true;
                return;
            }

            if (_currentUser.FollowedChanging)
            {
                followButton.Selected          = false;
                followButton.Enabled           = false;
                followButton.Layer.BorderWidth = 0;
                Constants.CreateGradient(followButton, _cornerRadius);
                progressBar.StartAnimating();
            }
            else
            {
                followButton.Enabled  = true;
                followButton.Selected = _currentUser.HasFollowed;
                progressBar.StopAnimating();
                if (_currentUser.HasFollowed)
                {
                    Constants.RemoveGradient(followButton);
                    followButton.Layer.BorderWidth = 1;
                }
                else
                {
                    followButton.Layer.BorderWidth = 0;
                    Constants.CreateGradient(followButton, _cornerRadius);
                }
            }
        }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationController.SetNavigationBarHidden(false, false);
            steemLogin.Layer.CornerRadius = newAccount.Layer.CornerRadius = 25;
            steemLogin.TitleLabel.Font    = newAccount.TitleLabel.Font = Constants.Semibold14;
            devSwitch.On = AppSettings.Settings.IsDev;
            Constants.CreateShadow(steemLogin, Constants.R231G72B0, 0.5f, 25, 10, 12);
            Constants.CreateShadow(newAccount, Constants.R204G204B204, 0.7f, 25, 10, 12);

            var devTap = new UITapGestureRecognizer(ToggleDevSwitchVisibility);

            devTap.NumberOfTapsRequired = 5;
            logo.AddGestureRecognizer(devTap);

            steemLogin.TouchDown   += GoToPreLogin;
            newAccount.TouchDown   += CreateAccount;
            devSwitch.ValueChanged += SwitchEnvironment;

            newAccount.Hidden = !_showRegistration;

            SetBackButton();
            SetAgreementDecoration();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            nsfwSwitch.On     = BasePresenter.User.IsNsfw;
            lowRatedSwitch.On = BasePresenter.User.IsLowRated;

            versionLabel.Font = Constants.Regular12;
            reportButton.Font = termsButton.Font = guideButton.Font = lowRatedLabel.Font = nsfwLabel.Font = addAccountButton.TitleLabel.Font = Constants.Semibold14;
            Constants.CreateShadow(addAccountButton, Constants.R231G72B0, 0.5f, 25, 10, 12);

            _tableSource             = new AccountsTableViewSource();
            _tableSource.Accounts    = BasePresenter.User.GetAllAccounts();
            _tableSource.CellAction += CellAction;

            accountsTable.Source        = _tableSource;
            accountsTable.LayoutMargins = UIEdgeInsets.Zero;
            accountsTable.RegisterClassForCellReuse(typeof(AccountTableViewCell), nameof(AccountTableViewCell));
            accountsTable.RegisterNibForCellReuse(UINib.FromName(nameof(AccountTableViewCell), NSBundle.MainBundle), nameof(AccountTableViewCell));
            accountsTable.RowHeight = 60f;

            lowRatedSwitch.Layer.CornerRadius = nsfwSwitch.Layer.CornerRadius = 16;

            var forwardImage  = new UIImageView();
            var forwardImage2 = new UIImageView();
            var forwardImage3 = new UIImageView();

            forwardImage2.Image = forwardImage3.Image = forwardImage.Image = UIImage.FromBundle("ic_forward");
            guideButton.AddSubview(forwardImage);
            termsButton.AddSubview(forwardImage2);
            reportButton.AddSubview(forwardImage3);

            forwardImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            forwardImage.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 0f);

            forwardImage2.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            forwardImage2.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 0f);

            forwardImage3.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            forwardImage3.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 0f);

            var appInfoService = AppSettings.Container.Resolve <IAppInfo>();

            versionLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.AppVersion2, appInfoService.GetAppVersion(), appInfoService.GetBuildVersion());

            reportButton.TouchDown      += SendReport;
            termsButton.TouchDown       += ShowTos;
            guideButton.TouchDown       += ShowGuide;
            lowRatedSwitch.ValueChanged += SwitchLowRated;
            nsfwSwitch.ValueChanged     += SwitchNSFW;
            SetBackButton();

#if !DEBUG
            lowRatedLabel.Hidden = nsfwLabel.Hidden = nsfwSwitch.Hidden = lowRatedSwitch.Hidden = true;
#endif
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Constants.CreateShadow(loginButton, Constants.R231G72B0, 0.5f, 25, 10, 12);
            loginText.Font   = Constants.Regular14;
            loginButton.Font = Constants.Semibold14;

            loginText.ShouldReturn += LoginShouldReturn;
            loginButton.TouchDown  += Login;
#if DEBUG
            var di = AppSettings.AssetHelper.GetDebugInfo();
            if (AppDelegate.MainChain == KnownChains.Steem)
            {
                loginText.Text = di.SteemTestLogin;
            }
            else
            {
                loginText.Text = di.GolosTestLogin;
            }
#endif
            NavigationController.SetNavigationBarHidden(false, false);
            SetBackButton();
        }
 public override void ViewDidLayoutSubviews()
 {
     base.ViewDidLayoutSubviews();
     Constants.CreateGradient(steemLogin, 25);
 }
 public override void ViewDidLayoutSubviews()
 {
     base.ViewDidLayoutSubviews();
     ResizeView();
     Constants.CreateGradient(addAccountButton, 25);
 }
        private void DeleteAlert(Post post)
        {
            CustomAlertView _deleteAlert = null;

            if (_deleteAlert == null)
            {
                var titleText       = AppSettings.LocalizationManager.GetText(LocalizationKeys.DeleteAlertTitle);
                var messageText     = AppSettings.LocalizationManager.GetText(LocalizationKeys.DeleteAlertMessage);
                var leftButtonText  = AppSettings.LocalizationManager.GetText(LocalizationKeys.Cancel);
                var rightButtonText = AppSettings.LocalizationManager.GetText(LocalizationKeys.Delete);

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

                dialog = new UIView();
                dialog.ClipsToBounds      = true;
                dialog.Layer.CornerRadius = 15;
                dialog.BackgroundColor    = UIColor.White;

                dialog.AutoSetDimension(ALDimension.Width, dialogWidth);

                // Title

                var title = new UILabel();
                title.Lines                  = 3;
                title.LineBreakMode          = UILineBreakMode.WordWrap;
                title.UserInteractionEnabled = false;
                title.Font            = Constants.Regular20;
                title.TextAlignment   = UITextAlignment.Center;
                title.Text            = titleText;
                title.BackgroundColor = UIColor.Clear;
                dialog.AddSubview(title);

                title.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 24);
                title.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 10);
                title.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);

                var size = title.SizeThatFits(new CGSize(dialogWidth - commonMargin * 2, 0));
                title.AutoSetDimension(ALDimension.Height, size.Height);

                // Alert message

                var message = new UILabel();
                message.Lines                  = 9;
                message.LineBreakMode          = UILineBreakMode.WordWrap;
                message.UserInteractionEnabled = false;
                message.Font            = Constants.Regular14;
                message.TextAlignment   = UITextAlignment.Center;
                message.Text            = messageText;
                message.BackgroundColor = UIColor.Clear;
                dialog.AddSubview(message);

                message.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, title, 22);
                message.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 10);
                message.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);

                size = message.SizeThatFits(new CGSize(dialogWidth - commonMargin * 2, 0));
                message.AutoSetDimension(ALDimension.Height, size.Height);

                // Separator

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

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

                var leftButton = CreateButton(leftButtonText, UIColor.Black);
                leftButton.Font = Constants.Semibold14;
                leftButton.Layer.BorderWidth = 1;
                leftButton.Layer.BorderColor = Constants.R245G245B245.CGColor;
                dialog.AddSubview(leftButton);

                leftButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, separator, 20);
                leftButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, commonMargin);
                leftButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, commonMargin);
                leftButton.AutoSetDimension(ALDimension.Width, dialogWidth / 2 - 27);
                leftButton.AutoSetDimension(ALDimension.Height, 50);

                rightButton      = CreateButton(rightButtonText, UIColor.White);
                rightButton.Font = Constants.Bold14;
                dialog.AddSubview(rightButton);

                rightButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, separator, 20);
                rightButton.AutoPinEdge(ALEdge.Left, ALEdge.Right, leftButton, 15);
                rightButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, commonMargin);
                rightButton.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, commonMargin);
                rightButton.AutoSetDimension(ALDimension.Width, dialogWidth / 2 - 27);
                rightButton.AutoSetDimension(ALDimension.Height, 50);
                rightButton.LayoutIfNeeded();

                NavigationController.View.EndEditing(true);

                _deleteAlert = new CustomAlertView(dialog, TabBarController);

                leftButton.TouchDown  += (sender, e) => { _deleteAlert.Close(); };
                rightButton.TouchDown += (sender, e) => { DeletePost(post, _deleteAlert.Close); };

                Constants.CreateGradient(rightButton, 25);
                Constants.CreateShadow(rightButton, Constants.R231G72B0, 0.5f, 25, 10, 12);
            }
            _deleteAlert.Show();
        }