public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _presenter.SourceChanged += SourceChanged;

            NavigationController.NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            NavigationController.NavigationBar.ShadowImage = new UIImage();

            tagsCollectionView.RegisterClassForCell(typeof(LocalTagCollectionViewCell), nameof(LocalTagCollectionViewCell));
            tagsCollectionView.RegisterNibForCell(UINib.FromName(nameof(LocalTagCollectionViewCell), NSBundle.MainBundle), nameof(LocalTagCollectionViewCell));
            tagsCollectionView.SetCollectionViewLayout(new UICollectionViewFlowLayout()
            {
                ScrollDirection = UICollectionViewScrollDirection.Horizontal,
                SectionInset    = new UIEdgeInsets(0, 15, 0, 15),
            }, false);

            tagsCollectionView.Source          = _viewSource;
            tagsCollectionView.Delegate        = _flowDelegate;
            tagsCollectionView.BackgroundColor = UIColor.White;

            _tagField = new SearchTextField("Hashtag");
            _tagField.ReturnButtonTapped += () => { AddLocalTag(_tagField.Text); };
            View.AddSubview(_tagField);

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

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

            View.AddGestureRecognizer(tap);

            _tableSource = new TagsTableViewSource(_presenter, tagsTableView);
            _tableSource.ScrolledToBottom += async() =>
            {
                _tagField.Loader.StartAnimating();
                var exception = await _presenter.TryLoadNext(_tagField.Text, false);

                _tagField.Loader.StopAnimating();
                ShowAlert(exception);
            };

            tagsTableView.Source        = _tableSource;
            tagsTableView.LayoutMargins = UIEdgeInsets.Zero;
            tagsTableView.RegisterClassForCellReuse(typeof(TagTableViewCell), nameof(TagTableViewCell));
            tagsTableView.RegisterNibForCellReuse(UINib.FromName(nameof(TagTableViewCell), NSBundle.MainBundle), nameof(TagTableViewCell));
            tagsTableView.RowHeight   = 70f;
            _tagField.EditingChanged += EditingDidChange;

            SetBackButton();
            SetCollectionHeight();
            SearchTextChanged();
        }
Example #2
0
        private void SetupTables()
        {
            _userTableSource = new FollowTableViewSource(_searchFacade.UserFriendPresenter, usersTable);
            _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;
            usersTable.ShowsVerticalScrollIndicator = false;

            var _tagsSource = new TagsTableViewSource(_searchFacade.TagsPresenter, tagsTable, true);

            _tagsSource.CellAction   += CellAction;
            tagsTable.Source          = _tagsSource;
            tagsTable.AllowsSelection = false;
            tagsTable.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            tagsTable.LayoutMargins   = UIEdgeInsets.Zero;
            tagsTable.RegisterClassForCellReuse(typeof(TagTableViewCell), nameof(TagTableViewCell));
            tagsTable.RegisterNibForCellReuse(UINib.FromName(nameof(TagTableViewCell), NSBundle.MainBundle), nameof(TagTableViewCell));
            tagsTable.RowHeight = 65f;
            tagsTable.ShowsVerticalScrollIndicator = false;
        }
Example #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Activeview = descriptionTextField;
            postPhotoButton.Layer.CornerRadius = 25;
            postPhotoButton.TitleLabel.Font    = Constants.Semibold14;
            tagField.Font = titleTextField.Font = descriptionTextField.Font = Constants.Regular14;

            _tableSource                = new TagsTableViewSource(_presenter);
            _tableSource.CellAction    += TableCellAction;
            tagsTableView.Source        = _tableSource;
            tagsTableView.LayoutMargins = UIEdgeInsets.Zero;
            tagsTableView.RegisterClassForCellReuse(typeof(TagTableViewCell), nameof(TagTableViewCell));
            tagsTableView.RegisterNibForCellReuse(UINib.FromName(nameof(TagTableViewCell), NSBundle.MainBundle), nameof(TagTableViewCell));
            tagsTableView.RowHeight = 65f;

            tagsCollectionView.RegisterClassForCell(typeof(LocalTagCollectionViewCell), nameof(LocalTagCollectionViewCell));
            tagsCollectionView.RegisterNibForCell(UINib.FromName(nameof(LocalTagCollectionViewCell), NSBundle.MainBundle), nameof(LocalTagCollectionViewCell));

            tagsCollectionView.SetCollectionViewLayout(new UICollectionViewFlowLayout()
            {
                ScrollDirection = UICollectionViewScrollDirection.Horizontal,
                SectionInset    = new UIEdgeInsets(0, 15, 0, 0),
            }, false);

            _collectionviewSource             = new LocalTagsCollectionViewSource();
            _collectionviewSource.CellAction += CollectionCellAction;
            _collectionViewDelegate           = new LocalTagsCollectionViewFlowDelegate(_collectionviewSource);
            tagsCollectionView.Source         = _collectionviewSource;
            tagsCollectionView.Delegate       = _collectionViewDelegate;

            tagField.Delegate         = new TagFieldDelegate(DoneTapped);
            tagField.EditingChanged  += EditingDidChange;
            tagField.EditingDidBegin += EditingDidBegin;
            tagField.EditingDidEnd   += EditingDidEnd;

            var tap = new UITapGestureRecognizer(RemoveFocusFromTextFields);

            View.AddGestureRecognizer(tap);

            var rotateTap = new UITapGestureRecognizer(RotateImage);

            rotateImage.AddGestureRecognizer(rotateTap);

            postPhotoButton.TouchDown += PostPhoto;

            _presenter.SourceChanged += SourceChanged;
            _timer = new Timer(OnTimer);

            SetBackButton();
            SearchTextChanged();
            SetPlaceholder();
        }
Example #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _searchFacade = new SearchFacade();

            _timer = new Timer(OnTimer);

            _userTableSource = new FollowTableViewSource(_searchFacade.UserFriendPresenter, usersTable);
            _userTableSource.ScrolledToBottom += GetItems;
            _userTableSource.CellAction       += CellAction;
            usersTable.Source        = _userTableSource;
            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));

            var _tagsSource = new TagsTableViewSource(_searchFacade.TagsPresenter);

            _tagsSource.CellAction += CellAction;
            tagsTable.Source        = _tagsSource;
            tagsTable.LayoutMargins = UIEdgeInsets.Zero;
            tagsTable.RegisterClassForCellReuse(typeof(TagTableViewCell), nameof(TagTableViewCell));
            tagsTable.RegisterNibForCellReuse(UINib.FromName(nameof(TagTableViewCell), NSBundle.MainBundle), nameof(TagTableViewCell));
            tagsTable.RowHeight = 65f;

            _searchFacade.UserFriendPresenter.SourceChanged += UserFriendPresenterSourceChanged;
            _searchFacade.TagsPresenter.SourceChanged       += TagsPresenterSourceChanged;

            searchTextField.BecomeFirstResponder();
            searchTextField.Font = Helpers.Constants.Regular14;
            noTagsLabel.Font     = Helpers.Constants.Light27;
            noTagsLabel.Text     = AppSettings.LocalizationManager.GetText(LocalizationKeys.EmptyQuery);

            searchTextField.ShouldReturn   += ShouldReturn;
            searchTextField.EditingChanged += EditingChanged;
            tagsButton.TouchDown           += TagsButtonTap;
            peopleButton.TouchDown         += PeopleButtonTap;

            SwitchSearchType();
            SetBackButton();
        }