Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TitleLabel.Text             = Resources.Clients;
            SearchTextField.Placeholder = Resources.AddFilterClients;

            SuggestionsTableView.RegisterNibForCellReuse(ClientViewCell.Nib, ClientViewCell.Identifier);
            SuggestionsTableView.RegisterNibForCellReuse(CreateClientViewCell.Nib, CreateClientViewCell.Identifier);
            SuggestionsTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            SuggestionsTableView.Source         = tableViewSource;

            ViewModel.Clients
            .Subscribe(replaceClients)
            .DisposedBy(DisposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);

            SearchTextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            tableViewSource.ClientSelected
            .Subscribe(ViewModel.SelectClient.Inputs)
            .DisposedBy(DisposeBag);

            SearchTextField.BecomeFirstResponder();
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new ClientTableViewSource(SuggestionsTableView);

            SuggestionsTableView.Source = source;

            var bindingSet = this.CreateBindingSet <SelectClientViewController, SelectClientViewModel>();

            bindingSet.Bind(source).To(vm => vm.Suggestions);
            bindingSet.Bind(SearchTextField).To(vm => vm.Text);
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(source)
            .For(v => v.SelectionChangedCommand)
            .To(vm => vm.SelectClientCommand);

            bindingSet.Bind(source)
            .For(v => v.CreateClientCommand)
            .To(vm => vm.CreateClientCommand);

            bindingSet.Bind(source)
            .For(v => v.SuggestCreation)
            .To(vm => vm.SuggestCreation);

            bindingSet.Bind(source)
            .For(v => v.Text)
            .To(vm => vm.Text);

            bindingSet.Apply();

            SearchTextField.BecomeFirstResponder();
        }
Esempio n. 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new WorkspaceTableViewSource(SuggestionsTableView);

            SuggestionsTableView.Source = source;

            var bindingSet = this.CreateBindingSet <SelectWorkspaceViewController, SelectWorkspaceViewModel>();

            bindingSet.Bind(TitleLabel).To(vm => vm.Title);

            bindingSet.Bind(source).To(vm => vm.Suggestions);
            bindingSet.Bind(SearchTextField).To(vm => vm.Text);
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(source)
            .For(v => v.SelectionChangedCommand)
            .To(vm => vm.SelectWorkspaceCommand);

            bindingSet.Bind(SuggestionsTableViewConstraint)
            .For(v => v.Constant)
            .To(vm => vm.AllowQuerying)
            .WithConversion(new BoolToConstantValueConverter <nfloat>(72, 24));

            bindingSet.Apply();

            if (ViewModel.AllowQuerying)
            {
                SearchTextField.BecomeFirstResponder();
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TitleLabel.Text             = Resources.CountryOfResidence;
            SearchTextField.Placeholder = Resources.Search;

            CountriesTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            CountriesTableView.RegisterNibForCellReuse(CountryViewCell.Nib, CountryViewCell.Identifier);
            CountriesTableView.RowHeight = rowHeight;

            var source = new CustomTableViewSource <SectionModel <string, SelectableCountryViewModel>, string, SelectableCountryViewModel>(
                CountryViewCell.CellConfiguration(CountryViewCell.Identifier));

            CountriesTableView.Source = source;

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectCountry.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.Countries
            .Subscribe(CountriesTableView.Rx().ReloadItems(source))
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);

            SearchTextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            SearchTextField.BecomeFirstResponder();
        }
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     _tagField.BecomeFirstResponder();
 }
Esempio n. 6
0
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     SearchTextField.BecomeFirstResponder();
 }
Esempio n. 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);
        }