Example #1
0
        private void SetupHistoryCollection()
        {
            _historyCollection = new UICollectionView(CGRect.Null, new UICollectionViewFlowLayout()
            {
                MinimumLineSpacing  = 0,
                FooterReferenceSize = new CGSize(0, 0),
            })
            {
                BackgroundColor = UIColor.Clear,
            };
            _historyCollection.RegisterClassForCell(typeof(TransactionCollectionViewCell), nameof(TransactionCollectionViewCell));
            _historyCollection.RegisterClassForCell(typeof(TransactionShimmerCollectionViewCell), nameof(TransactionShimmerCollectionViewCell));
            _historyCollection.RegisterClassForCell(typeof(ClaimTransactionCollectionViewCell), nameof(ClaimTransactionCollectionViewCell));
            _historyCollection.RegisterClassForSupplementaryView(typeof(TransactionHeaderCollectionViewCell), UICollectionElementKindSection.Header, nameof(TransactionHeaderCollectionViewCell));
            _historyCollection.RegisterClassForSupplementaryView(typeof(CardsContainerHeader), UICollectionElementKindSection.Header, nameof(CardsContainerHeader));

            View.Add(_historyCollection);

            _historySource = new TransferCollectionViewSource(_presenter, NavigationController);

            _historySource.CellAction += (string obj) =>
            {
                if (obj == AppSettings.User.Login)
                {
                    return;
                }
                var myViewController = new ProfileViewController();
                myViewController.Username = obj;
                NavigationController.PushViewController(myViewController, true);
            };

            _historyCollection.Source   = _historySource;
            _historyCollection.Delegate = new TransactionHistoryCollectionViewFlowDelegate(_historySource);

            _historyCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            _historyCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _historyCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _historyCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
        }
        protected void SetupPhotoCollection()
        {
            photoCollection = new UICollectionView(CGRect.Null, new UICollectionViewFlowLayout()
            {
                ScrollDirection         = UICollectionViewScrollDirection.Horizontal,
                ItemSize                = _cellSize,
                SectionInset            = new UIEdgeInsets(0, sectionInset, 0, sectionInset),
                MinimumInteritemSpacing = 10,
            });
            photoCollection.BackgroundColor = UIColor.White;

            mainScroll.AddSubview(photoCollection);

            photoCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            photoCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 30f);
            photoCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            photoCollection.AutoSetDimension(ALDimension.Height, _cellSize.Height);
            photoCollection.AutoSetDimension(ALDimension.Width, UIScreen.MainScreen.Bounds.Width);

            photoCollection.Bounces = false;
            photoCollection.ShowsHorizontalScrollIndicator = false;
            photoCollection.RegisterClassForCell(typeof(PhotoGalleryCell), nameof(PhotoGalleryCell));
        }
Example #3
0
        private void SetupCardsCollection()
        {
            var cellProportion = 240f / 335f;
            var cellSize       = new CGSize(UIScreen.MainScreen.Bounds.Width - 20f * 2f, (UIScreen.MainScreen.Bounds.Width - 20f * 2f) * cellProportion);
            var cardProportion = 190f / 335f;
            var cardCenter     = ((UIScreen.MainScreen.Bounds.Width - 20f * 2f) * cardProportion / 2) + 20;
            var cardBottom     = ((UIScreen.MainScreen.Bounds.Width - 20f * 2f) * cardProportion) + 25;

            _cardBehind.BackgroundColor    = UIColor.FromRGB(255, 255, 255);
            _cardBehind.Layer.CornerRadius = 16;
            Constants.CreateShadowFromZeplin(_cardBehind, UIColor.FromRGB(0, 0, 0), 0.03f, 0, 1, 1, 0);
            AddSubview(_cardBehind);

            _cardBehind.AutoPinEdgeToSuperviewEdge(ALEdge.Top, cardCenter);
            _cardBehind.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 10);
            _cardBehind.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 10);
            _cardBehind.AutoSetDimension(ALDimension.Height, cardCenter + 115);

            _cardsCollection = new UICollectionView(CGRect.Null, new SliderFlowLayout()
            {
                ScrollDirection    = UICollectionViewScrollDirection.Horizontal,
                ItemSize           = cellSize,
                MinimumLineSpacing = 10,
                SectionInset       = new UIEdgeInsets(0, 20, 0, 20),
            })
            {
                BackgroundColor = UIColor.Clear
            };

            _cardsCollection.RegisterClassForCell(typeof(CardShimmerCollectionView), nameof(CardShimmerCollectionView));
            _cardsCollection.RegisterClassForCell(typeof(CardCollectionViewCell), nameof(CardCollectionViewCell));
            AddSubview(_cardsCollection);

            _cardsCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 20);
            _cardsCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _cardsCollection.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            _cardsCollection.AutoSetDimension(ALDimension.Height, cellSize.Height);

            _cardsGridDelegate.CardsScrolled += () =>
            {
                var pageWidth = cellSize.Width + 20;
                _pageControl.CurrentPage = (int)Math.Floor((_cardsCollection.ContentOffset.X - pageWidth / 2) / pageWidth) + 1;
            };

            _cardsCollection.UserInteractionEnabled         = false;
            _cardsCollection.DecelerationRate               = UIScrollView.DecelerationRateFast;
            _cardsCollection.ShowsHorizontalScrollIndicator = false;
            _cardsCollection.Layer.MasksToBounds            = false;
            _cardsCollection.ClipsToBounds = false;

            _pageControl.Pages = 5;
            _pageControl.PageIndicatorTintColor        = UIColor.FromRGB(0, 0, 0).ColorWithAlpha(0.1f);
            _pageControl.CurrentPageIndicatorTintColor = UIColor.FromRGB(0, 0, 0).ColorWithAlpha(0.4f);
            _pageControl.UserInteractionEnabled        = false;
            AddSubview(_pageControl);

            _pageControl.AutoPinEdgeToSuperviewEdge(ALEdge.Top, cardBottom);
            _pageControl.AutoAlignAxis(ALAxis.Vertical, _cardsCollection);

            transfer.Enabled = false;
            transfer.SetTitle("TRANSFER", UIControlState.Normal);
            transfer.Font = Constants.Bold14;
            transfer.SetTitleColor(UIColor.White, UIControlState.Normal);
            transfer.Layer.CornerRadius = 25;
            transfer.BackgroundColor    = UIColor.FromRGB(230, 230, 230);
            transfer.ClipsToBounds      = true;
            AddSubview(transfer);

            transfer.TouchDown += (object sender, EventArgs e) =>
            {
                _navigationController.PushViewController(new TransferViewController(), true);
            };

            transfer.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _pageControl, 20);
            transfer.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            transfer.AutoSetDimension(ALDimension.Height, 50);

            more.Enabled         = false;
            more.BackgroundColor = Constants.R250G250B250;
            more.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal);
            more.Layer.CornerRadius = 25;
            more.ClipsToBounds      = true;
            more.TouchDown         += (object sender, EventArgs e) =>
            {
                Popups.PowerManipulationPopup.Create(_navigationController, _presenter, async(bool response) =>
                {
                    if (response)
                    {
                        var balance = _presenter.Balances[0];
                        var model   = new BalanceModel(0, balance.MaxDecimals, balance.CurrencyType)
                        {
                            UserInfo = balance.UserInfo
                        };

                        await _presenter.TryPowerUpOrDown(model, PowerAction.CancelPowerDown);
                        _presenter.UpdateWallet?.Invoke();
                    }
                });
            };
            AddSubview(more);

            more.AutoAlignAxis(ALAxis.Horizontal, transfer);
            more.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            more.AutoPinEdge(ALEdge.Left, ALEdge.Right, transfer, 10);
            more.AutoSetDimensionsToSize(new CGSize(50, 50));

            var historyLabel = new UILabel();

            historyLabel.Text      = "Transaction history";
            historyLabel.Font      = Constants.Regular20;
            historyLabel.TextColor = UIColor.Black;

            AddSubview(historyLabel);

            historyLabel.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _cardBehind, 27);
            historyLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            historyLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
        }