예제 #1
0
 private void SetupView()
 {
     NavigationController.NavigationBar.TopItem.Title = string.Empty;
     NavigationController.NavigationBar.TintColor     = Colors.White;
     NavigationItem.LargeTitleDisplayMode             = UINavigationItemLargeTitleDisplayMode.Never;
     NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(24, "podcast_share", SharePodcast);
 }
예제 #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var titleViewMaxSize = ScreenWidth - LocalConstants.Chat_TotalIconsWidth;

            this.NavigationItem.TitleView = ViewModel.Chat == null
                ? CustomUIExtensions.SetupNavigationBarWithSubtitle(ViewModel.MemberName, ViewModel.MemberDetails, titleViewMaxSize)
                : CustomUIExtensions.SetupNavigationBarWithSubtitle(ViewModel.Chat.MemberName, ViewModel.Chat.MemberDetails, titleViewMaxSize);

            this.NavigationController.NavigationBar.TintColor           = Colors.MainBlue;
            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes {
                ForegroundColor = Colors.White
            };
            this.NavigationItem.LeftBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "back_white", CloseView);

            this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] {
                UIButtonExtensions.SetupBarWithTwoButtons(LocalConstants.TabBarIconSize, "options", Options),
                UIButtonExtensions.SetupBarWithTwoButtons(LocalConstants.TabBarIconSize, "call_white_medium", CallUser)
            };

            this.NavigationController.InteractivePopGestureRecognizer.Delegate = new UIGestureRecognizerDelegate();
            this.NavigationController.NavigationBar.BarTintColor = Colors.MainBlue;
            this.NavigationController.NavigationBar.Translucent  = false;
            this.NavigationController.SetNavigationBarHidden(false, true);
            this.NavigationController.NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            this.NavigationController.NavigationBar.ShadowImage = new UIImage();
            UIApplication.SharedApplication.StatusBarStyle      = UIStatusBarStyle.LightContent;
            _navBarView.BackgroundColor = Colors.MainBlue;

            UpdateTableView();
        }
예제 #3
0
 private void ConfigureView()
 {
     this.Title = ViewModel.Title;
     if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
     {
         this.NavigationController.NavigationBar.PrefersLargeTitles = true;
     }
     this.NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "new_call", OpenContacts, false);
     _tableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
 }
예제 #4
0
        private void ConfigureView()
        {
            this.NavigationController.NavigationBar.PrefersLargeTitles = true;
            NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(24, "main_info", OpenInformationView);

            var search = new UISearchController(searchResultsController: null)
            {
                DimsBackgroundDuringPresentation = false,
            };

            search.SearchBar.TintColor   = UIColor.White;
            search.SearchBar.Placeholder = ViewModel.Search;

            NSString _searchField             = new NSString("searchField");
            var      textFieldInsideSearchBar = (UITextField)search.SearchBar.ValueForKey(_searchField);
            var      backgroundField          = textFieldInsideSearchBar.Subviews[0];

            backgroundField.BackgroundColor    = Colors.White.ColorWithAlpha(1);
            backgroundField.Alpha              = 1;
            backgroundField.Layer.CornerRadius = 10f;
            backgroundField.ClipsToBounds      = true;

            _pickerHeaderView.BackgroundColor     = Colors.MainBlue;
            _pickerHeaderView.Layer.ShadowColor   = Colors.Black.CGColor;
            _pickerHeaderView.Layer.ShadowOffset  = new CGSize(5, 5);
            _pickerHeaderView.Layer.ShadowRadius  = 7;
            _pickerHeaderView.Layer.ShadowOpacity = 12;
            _pickerHeaderView.Layer.MasksToBounds = false;

            search.SearchBar.OnEditingStarted -= OnSearchBar_OnEditingStarted;
            search.SearchBar.OnEditingStarted += OnSearchBar_OnEditingStarted;

            search.SearchBar.OnEditingStopped -= OnSearchBar_OnEditingStopped;
            search.SearchBar.OnEditingStopped += OnSearchBar_OnEditingStopped;

            search.SearchBar.CancelButtonClicked -= OnSearchBar_CancelButtonClicked;
            search.SearchBar.CancelButtonClicked += OnSearchBar_CancelButtonClicked;

            search.SearchResultsUpdater     = this;
            DefinesPresentationContext      = true;
            NavigationItem.SearchController = search;

            UILabelExtensions.SetupLabelAppearance(_noResultsLabel, ViewModel.NoResultsLabel, Colors.Black, 15f, UIFontWeight.Medium);

            _noResultsView.Hidden = true;
            _tableView.Hidden     = true;
            PickerSwitch(true);

            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(() => PickerSwitch(true));

            _closeTabView.AddGestureRecognizer(tapGesture);
            _closeTabView.Alpha = 0.4f;
        }
예제 #5
0
        private void ConfigureView()
        {
            this.Title = ViewModel.Title;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                this.NavigationController.NavigationBar.PrefersLargeTitles = true;
                this.NavigationItem.HidesSearchBarWhenScrolling            = true;
            }

            this.NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "newchat", OpenContacts, false);
            _tableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            _search = new UISearchController(searchResultsController: null)
            {
                DimsBackgroundDuringPresentation = false
            };
            _search.SearchBar.TintColor = Colors.White;
            _search.SearchBar.BarStyle  = UIBarStyle.Black;

            _textFieldInsideSearchBar = _search.SearchBar.ValueForKey(new NSString("searchField")) as UITextField;
            _textFieldInsideSearchBar.ReturnKeyType   = UIReturnKeyType.Done;
            _textFieldInsideSearchBar.ClearButtonMode = UITextFieldViewMode.Never;

            _search.SearchResultsUpdater = this;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                _textFieldInsideSearchBar.Subviews[0].Alpha = 0.5f;

                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("search"), UISearchBarIcon.Search, UIControlState.Normal);
                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("clear"), UISearchBarIcon.Clear, UIControlState.Normal);

                this.DefinesPresentationContext      = true;
                this.NavigationItem.SearchController = _search;
            }
            else
            {
                this.DefinesPresentationContext = false;
                _search.HidesNavigationBarDuringPresentation = false;
                _search.SearchBar.BarStyle = UIBarStyle.Default;
                _tableView.TableHeaderView = _search.SearchBar;
            }

            _search.SearchBar.OnEditingStarted -= OnSearchBar_OnEditingStarted;
            _search.SearchBar.OnEditingStarted += OnSearchBar_OnEditingStarted;

            _search.SearchBar.CancelButtonClicked -= OnSearchBar_CancelButtonClicked;
            _search.SearchBar.CancelButtonClicked += OnSearchBar_CancelButtonClicked;
        }
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
     {
         ForegroundColor = Colors.White
     };
     this.NavigationItem.LeftBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "back_white", CloseView);
     this.NavigationController.InteractivePopGestureRecognizer.Delegate = new UIGestureRecognizerDelegate();
     this.NavigationController.NavigationBar.BarTintColor = Colors.MainBlue;
     this.NavigationController.NavigationBar.Translucent  = false;
     this.NavigationController.SetNavigationBarHidden(false, true);
     this.NavigationController.NavigationBar.ShadowImage = new UIImage();
     UIApplication.SharedApplication.StatusBarStyle      = UIStatusBarStyle.LightContent;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _viewSize = (float)UIScreen.MainScreen.Bounds.Width;
            _barView  = new UIView();
            _barView.BackgroundColor       = Colors.MainBlue;
            _separatorView.BackgroundColor = Colors.GrayDividerContacts;
            _separatorView.Hidden          = true;

            if (ViewModel.IsPresentingCustomView == ContactListViewModel.ContactsType.All)
            {
                this.Title = ViewModel.Title;

                if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
                {
                    this.NavigationController.NavigationBar.PrefersLargeTitles = false;
                    this.NavigationItem.LargeTitleDisplayMode = UINavigationItemLargeTitleDisplayMode.Never;
                }

                this.NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "contacts_filter", OpenFilter, false);

                _presentView.Hidden = true;
                _presentViewHeightConstraint.Constant = 0;
            }
            else
            {
                UILabelExtensions.SetupLabelAppearance(_titleLabel, ViewModel.IsPresentingCustomView == ContactListViewModel.ContactsType.Call ? ViewModel.NewCallTitle : ViewModel.NewChatTitle,
                                                       Colors.Black, 17f, UIFontWeight.Semibold);
                UIButtonExtensions.SetupButtonAppearance(_cancelButton, _cancelButton.TintColor, 17f, ViewModel.Cancel);

                _cancelButton.TitleLabel.Lines = 1;
                _cancelButton.TitleLabel.AdjustsFontSizeToFitWidth = true;
                _cancelButton.TitleLabel.LineBreakMode             = UILineBreakMode.Clip;
                _cancelButton.TouchUpInside -= OnCancelButton_TouchUpInside;
                _cancelButton.TouchUpInside += OnCancelButton_TouchUpInside;

                if (PhoneModelExtensions.IsIphoneX())
                {
                    _titleLabelHeightConstraint.Constant = _titleLabelHeightConstraint.Constant + 10;
                }
            }

            _pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal);

            this.AddChildViewController(_pageViewController);
            _pageView.AddSubview(_pageViewController.View);

            _tableViewGesture.AddTarget(() => HandleDrag(_tableViewGesture));

            this.View.AddSubview(_barView);
            this.View.BringSubviewToFront(_barView);

            ConfigureView();

            _search = new UISearchController(searchResultsController: null)
            {
                DimsBackgroundDuringPresentation = false
            };
            _search.SearchBar.TintColor = Colors.White;
            _search.SearchBar.BarStyle  = UIBarStyle.Black;

            _textFieldInsideSearchBar = _search.SearchBar.ValueForKey(new NSString("searchField")) as UITextField;
            _textFieldInsideSearchBar.ReturnKeyType   = UIReturnKeyType.Done;
            _textFieldInsideSearchBar.ClearButtonMode = UITextFieldViewMode.Never;

            _search.SearchBar.OnEditingStarted -= OnSearchBar_OnEditingStarted;
            _search.SearchBar.OnEditingStarted += OnSearchBar_OnEditingStarted;

            _search.SearchBar.OnEditingStopped -= OnSearchBar_OnEditingStopped;
            _search.SearchBar.OnEditingStopped += OnSearchBar_OnEditingStopped;

            _search.SearchBar.CancelButtonClicked -= OnSearchBar_CancelButtonClicked;
            _search.SearchBar.CancelButtonClicked += OnSearchBar_CancelButtonClicked;

            _search.SearchResultsUpdater = this;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                _textFieldInsideSearchBar.Text = ViewModel.SearchLabel;
                _textFieldInsideSearchBar.Subviews[0].Alpha = 0.07f;

                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("search"), UISearchBarIcon.Search, UIControlState.Normal);
                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("clear"), UISearchBarIcon.Clear, UIControlState.Normal);

                this.DefinesPresentationContext      = true;
                this.NavigationItem.SearchController = _search;
            }
            else
            {
                this.DefinesPresentationContext = false;
                _search.HidesNavigationBarDuringPresentation = false;
                _search.SearchBar.BarStyle = UIBarStyle.Default;

                if (_tableViews?.Count > 0)
                {
                    _tableViews.FirstOrDefault().TableHeaderView = _search.SearchBar;
                }
            }

            ViewModel.PropertyChanged -= ViewModel_PropertyChanged;
            ViewModel.PropertyChanged += ViewModel_PropertyChanged;
        }