protected TransactionShimmerCollectionViewCell(IntPtr handle) : base(handle)
        {
            var sideMargin = DeviceHelper.IsSmallDevice ? 15 : 30;

            var background = new CustomView();

            background.BackgroundColor    = UIColor.FromRGB(230, 230, 230);
            background.Layer.CornerRadius = 16;
            ContentView.AddSubview(background);

            background.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 60);
            background.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 5);
            background.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);
            background.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 5);

            var emptyBackground = new UIView();

            ContentView.AddSubview(emptyBackground);

            emptyBackground.AutoPinEdge(ALEdge.Right, ALEdge.Left, background);
            emptyBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            emptyBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            emptyBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            var leftContainer = new CustomView();

            background.AddSubview(leftContainer);

            leftContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Left, sideMargin);
            leftContainer.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            _action.ClipsToBounds      = true;
            _action.Layer.CornerRadius = 7.5f;
            _action.BackgroundColor    = UIColor.White.ColorWithAlpha(0.5f);
            leftContainer.AddSubview(_action);

            _action.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            _action.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _action.AutoSetDimensionsToSize(new CGSize(80, 15));

            var _to = new UIView();

            _to.ClipsToBounds      = true;
            _to.Layer.CornerRadius = 7.5f;
            _to.BackgroundColor    = UIColor.White.ColorWithAlpha(0.5f);
            leftContainer.AddSubview(_to);

            _to.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _action, 10);
            _to.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _to.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _to.AutoSetDimensionsToSize(new CGSize(120, 15));

            _amount.ClipsToBounds      = true;
            _amount.Layer.CornerRadius = 10f;
            _amount.BackgroundColor    = UIColor.White.ColorWithAlpha(0.5f);
            background.AddSubview(_amount);

            _amount.AutoSetDimensionsToSize(new CGSize(80, 20));
            _amount.AutoPinEdge(ALEdge.Left, ALEdge.Right, leftContainer);
            _amount.AutoAlignAxis(ALAxis.Horizontal, leftContainer);
            _amount.AutoPinEdgeToSuperviewEdge(ALEdge.Right, sideMargin);

            var circle = new UIView();

            circle.BackgroundColor    = UIColor.FromRGB(230, 230, 230);
            circle.Layer.CornerRadius = 4;
            emptyBackground.AddSubview(circle);

            circle.AutoSetDimensionsToSize(new CGSize(8, 8));
            circle.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            circle.AutoAlignAxisToSuperviewAxis(ALAxis.Vertical);

            _topLine = new UIView();
            _topLine.BackgroundColor    = UIColor.FromRGB(240, 240, 240);
            _topLine.Layer.CornerRadius = 1;
            emptyBackground.AddSubview(_topLine);

            _topLine.AutoSetDimension(ALDimension.Width, 2);
            _topLine.AutoAlignAxisToSuperviewAxis(ALAxis.Vertical);
            _topLine.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            _topLine.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, circle, -16);

            _bottomLine = new UIView();
            _bottomLine.BackgroundColor    = UIColor.FromRGB(240, 240, 240);
            _bottomLine.Layer.CornerRadius = 1;
            emptyBackground.AddSubview(_bottomLine);

            _bottomLine.AutoSetDimension(ALDimension.Width, 2);
            _bottomLine.AutoAlignAxisToSuperviewAxis(ALAxis.Vertical);
            _bottomLine.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _bottomLine.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, circle, 16);

            leftContainer.SubviewLayouted += () =>
            {
                Constants.ApplyShimmer(_action);
                Constants.ApplyShimmer(_to);
            };

            background.SubviewLayouted += () =>
            {
                Constants.ApplyShimmer(_amount);
            };
        }
コード例 #2
0
        protected CardShimmerCollectionView(IntPtr handle) : base(handle)
        {
            CustomView _image = new CustomView();

            _image.BackgroundColor    = UIColor.FromRGB(230, 230, 230);
            _image.ClipsToBounds      = true;
            _image.Layer.CornerRadius = 15;
            ContentView.AddSubview(_image);
            _image.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _image.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            _image.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            _image.AutoSetDimension(ALDimension.Height, ContentView.Frame.Width * 190f / 335f);

            _shadowHelper.BackgroundColor = UIColor.White;
            ContentView.AddSubview(_shadowHelper);
            _shadowHelper.AutoPinEdge(ALEdge.Left, ALEdge.Left, _image, 20);
            _shadowHelper.AutoPinEdge(ALEdge.Right, ALEdge.Right, _image, -20);
            _shadowHelper.AutoPinEdge(ALEdge.Bottom, ALEdge.Bottom, _image);
            _shadowHelper.AutoPinEdge(ALEdge.Top, ALEdge.Top, _image);
            ContentView.BringSubviewToFront(_image);

            var loginBackground = new UIView();

            loginBackground.ClipsToBounds      = true;
            loginBackground.Layer.CornerRadius = 15;
            loginBackground.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);

            _image.AddSubview(loginBackground);

            loginBackground.AutoSetDimensionsToSize(new CGSize(140, 32));
            loginBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Right, -20);
            loginBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 21);

            UILabel _balanceLabel = new UILabel();

            _balanceLabel.Font               = Constants.Semibold14;
            _balanceLabel.Text               = "Steem balance";
            _balanceLabel.ClipsToBounds      = true;
            _balanceLabel.Layer.CornerRadius = 9;
            _balanceLabel.TextColor          = UIColor.Clear;
            _balanceLabel.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            _image.AddSubview(_balanceLabel);

            _balanceLabel.AutoAlignAxis(ALAxis.Horizontal, loginBackground);
            _balanceLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30);

            _equivalentBalance.Text               = "2422,222";
            _equivalentBalance.Font               = Constants.Bold34;
            _equivalentBalance.ClipsToBounds      = true;
            _equivalentBalance.Layer.CornerRadius = 22;
            _equivalentBalance.TextColor          = UIColor.Clear;
            _equivalentBalance.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            _image.AddSubview(_equivalentBalance);

            _equivalentBalance.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30);
            _equivalentBalance.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, loginBackground);

            var bottomContainer = new UIView();

            _image.AddSubview(bottomContainer);

            bottomContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30);
            bottomContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 30);
            bottomContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            bottomContainer.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _equivalentBalance);

            var steemContainer = new CustomView();

            bottomContainer.AddSubview(steemContainer);

            steemContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            steemContainer.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            steemContainer.AutoMatchDimensionWithMultiplier(ALDimension.Width, ALDimension.Width, bottomContainer, 0.5f);

            _firstTokenLabel.Text               = "Steem";
            _firstTokenLabel.ClipsToBounds      = true;
            _firstTokenLabel.Layer.CornerRadius = 10;
            _firstTokenLabel.TextColor          = UIColor.Clear;
            _firstTokenLabel.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            _firstTokenLabel.Font               = Constants.Semibold14;
            steemContainer.AddSubview(_firstTokenLabel);

            _firstTokenLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _firstTokenLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top);

            _firstTokenValue.Text               = "999.999";
            _firstTokenValue.ClipsToBounds      = true;
            _firstTokenValue.Font               = Constants.Semibold20;
            _firstTokenValue.Layer.CornerRadius = 15;
            _firstTokenValue.TextColor          = UIColor.Clear;
            _firstTokenValue.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            steemContainer.AddSubview(_firstTokenValue);

            _firstTokenValue.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _firstTokenValue.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _firstTokenValue.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _firstTokenLabel, 5);

            var steemPowerContainer = new CustomView();

            bottomContainer.AddSubview(steemPowerContainer);

            steemPowerContainer.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            steemPowerContainer.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            steemPowerContainer.AutoMatchDimensionWithMultiplier(ALDimension.Width, ALDimension.Width, bottomContainer, 0.5f);

            _secondTokenLabel.ClipsToBounds      = true;
            _secondTokenLabel.Text               = "Steem Power";
            _secondTokenLabel.Font               = Constants.Semibold14;
            _secondTokenLabel.Layer.CornerRadius = 10;
            _secondTokenLabel.TextColor          = UIColor.Clear;
            _secondTokenLabel.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            _secondTokenLabel.Font               = Constants.Semibold14;
            steemPowerContainer.AddSubview(_secondTokenLabel);

            _secondTokenLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _secondTokenLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top);

            _secondTokenValue.ClipsToBounds      = true;
            _secondTokenValue.Text               = "999.999";
            _secondTokenValue.Font               = Constants.Semibold20;
            _secondTokenValue.Layer.CornerRadius = 15;
            _secondTokenValue.TextColor          = UIColor.Clear;
            _secondTokenValue.BackgroundColor    = Constants.R255G255B255.ColorWithAlpha(0.5f);
            steemPowerContainer.AddSubview(_secondTokenValue);

            _secondTokenValue.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _secondTokenValue.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _secondTokenValue.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _secondTokenLabel, 5);

            _image.SubviewLayouted += () =>
            {
                Constants.ApplyShimmer(_balanceLabel);
                Constants.ApplyShimmer(loginBackground);
                Constants.ApplyShimmer(_equivalentBalance);
            };

            steemContainer.SubviewLayouted += () =>
            {
                Constants.ApplyShimmer(_firstTokenLabel);
                Constants.ApplyShimmer(_firstTokenValue);
            };

            steemContainer.SubviewLayouted += () =>
            {
                Constants.ApplyShimmer(_secondTokenLabel);
                Constants.ApplyShimmer(_secondTokenValue);
            };
        }
コード例 #3
0
        public static void Show(UIView viewToAdd)
        {
            var warningView = new CustomView();

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

            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            warningView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 15);
            var warningViewToTopConstraint    = warningView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, viewToAdd);
            var warningViewToBottomConstraint = warningView.AutoPinEdge(ALEdge.Bottom, ALEdge.Bottom, viewToAdd, -20);

            warningViewToBottomConstraint.Active = false;

            var warningImage = new UIImageView();

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

            var warningLabel = new UILabel();

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

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

            warningImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            warningImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            warningImage.SetContentCompressionResistancePriority(999, UILayoutConstraintAxis.Horizontal);

            warningLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, warningImage, 20);
            warningLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 20);
            warningLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 20);
            warningLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);

            warningView.SubviewLayouted += () =>
            {
                UIView.Animate(0.3f, 0f, UIViewAnimationOptions.CurveEaseOut, () =>
                {
                    warningViewToTopConstraint.Active    = false;
                    warningViewToBottomConstraint.Active = true;
                    warningView.Alpha = 1;
                    viewToAdd.LayoutIfNeeded();
                }, () =>
                {
                    UIView.Animate(0.2f, 7f, UIViewAnimationOptions.CurveEaseIn, () =>
                    {
                        warningViewToTopConstraint.Active    = true;
                        warningViewToBottomConstraint.Active = false;
                        warningView.Alpha = 0;
                        viewToAdd.LayoutIfNeeded();
                    }, () => {
                        warningView?.RemoveFromSuperview();
                        warningView = null;
                    });
                });
            };
        }