Exemplo n.º 1
0
            public void OnConfigureTab(TabLayout.Tab p0, int p1)
            {
                switch (p1)
                {
                case 0:
                {
                    p0.SetText("Track");
                    break;
                }

                case 1:
                {
                    p0.SetText("Tracks");
                    break;
                }

                case 2:
                {
                    p0.SetText("Logs");
                    break;
                }

                default:
                    p0.SetText("");
                    break;
                }
            }
Exemplo n.º 2
0
 void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == Page.TitleProperty.PropertyName)
     {
         var           page  = (Page)sender;
         var           index = Element.Children.IndexOf(page);
         TabLayout.Tab tab   = _tabLayout.GetTabAt(index);
         tab.SetText(page.Title);
     }
 }
Exemplo n.º 3
0
 public void OnConfigureTab(TabLayout.Tab tab, int position)
 {
     try
     {
         tab.SetText(Adapter.GetFragment(position));
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Exemplo n.º 4
0
 void TabLayout.IOnTabSelectedListener.OnTabReselected(TabLayout.Tab tab)
 {
     // To have the logic only on he tab on position 1
     if (tab == null || tab.Position != 1)
     {
         return;
     }
     if (tab.Text == "Play")
     {
         tab.SetText("Pause");
         tab.SetIcon(Resource.Drawable.ionicons_2_0_1_pause_outline_25);
         App.pauseCard = false;
     }
     else
     {
         tab.SetText("Play");
         tab.SetIcon(Resource.Drawable.ionicons_2_0_1_play_outline_25);
         App.pauseCard = true;
     }
     SetTintColor(tab, GetTabColor());
 }
Exemplo n.º 5
0
        void TabLayoutMediator.ITabConfigurationStrategy.OnConfigureTab(TabLayout.Tab tab, int position)
        {
            if (_selecting)
            {
                return;
            }

            tab.SetText(new String(SectionController.GetItems()[position].Title));
            // TODO : Find a way to make this cancellable
            var shellSection = ShellSection;
            var shellContent = SectionController.GetItems()[position];

            if (shellContent == shellSection.CurrentItem)
            {
                return;
            }

            var  stack  = shellSection.Stack.ToList();
            bool result = ShellController.ProposeNavigation(ShellNavigationSource.ShellContentChanged,
                                                            (ShellItem)shellSection.Parent, shellSection, shellContent, stack, true);

            if (result)
            {
                UpdateCurrentItem(shellContent);
            }
            else if (shellSection?.CurrentItem != null)
            {
                var currentPosition = SectionController.GetItems().IndexOf(shellSection.CurrentItem);
                _selecting = true;

                // Android doesn't really appreciate you calling SetCurrentItem inside a OnPageSelected callback.
                // It wont crash but the way its programmed doesn't really anticipate re-entrancy around that method
                // and it ends up going to the wrong location. Thus we must invoke.

                Device.BeginInvokeOnMainThread(() =>
                {
                    if (currentPosition < _viewPager.ChildCount && _toolbarTracker != null)
                    {
                        _viewPager.SetCurrentItem(currentPosition, false);
                        UpdateCurrentItem(shellSection.CurrentItem);
                    }

                    _selecting = false;
                });
            }
        }
Exemplo n.º 6
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);

                if (IsBottomTabPlacement)
                {
                    IMenuItem tab = _bottomNavigationView.Menu.GetItem(index);
                    tab.SetTitle(page.Title);
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    tab.SetText(page.Title);
                }
            }
        }
Exemplo n.º 7
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);

                if (IsBottomTabPlacement)
                {
                    IMenuItem tab = _bottomNavigationView.Menu.GetItem(index);
                    tab.SetTitle(page.Title);
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    tab.SetText(page.Title);
                }
            }
            else if (e.PropertyName == Page.IconImageSourceProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);
                if (IsBottomTabPlacement)
                {
                    var menuItem = _bottomNavigationView.Menu.GetItem(index);
                    _ = this.ApplyDrawableAsync(page, Page.IconImageSourceProperty, Context, icon =>
                    {
                        menuItem.SetIcon(icon);
                    });
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    _ = this.ApplyDrawableAsync(page, Page.IconImageSourceProperty, Context, icon =>
                    {
                        SetTabIcon(tab, icon);
                    });
                }
            }
        }
Exemplo n.º 8
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);

                if (IsBottomTabPlacement)
                {
                    IMenuItem tab = _bottomNavigationView.Menu.GetItem(index);
                    tab.SetTitle(page.Title);
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    tab.SetText(page.Title);
                }
            }
            else if (e.PropertyName == Page.IconImageSourceProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);
                if (IsBottomTabPlacement)
                {
                    var menuItem = _bottomNavigationView.Menu.GetItem(index);
                    page.IconImageSource.LoadImage(
                        _context,
                        result =>
                    {
                        menuItem.SetIcon(result.Value);
                    });
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    SetTabIconImageSource(page, tab);
                }
            }
        }
Exemplo n.º 9
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = Element.Children.IndexOf(page);

                if (IsBottomTabPlacement)
                {
                    IMenuItem tab = _bottomNavigationView.Menu.GetItem(index);
                    tab.SetTitle(page.Title);
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    tab.SetText(page.Title);
                }
            }
            else if (e.PropertyName == Page.IconProperty.PropertyName)
            {
                var             page  = (Page)sender;
                var             index = Element.Children.IndexOf(page);
                FileImageSource icon  = page.Icon;

                if (IsBottomTabPlacement)
                {
                    var menuItem = _bottomNavigationView.Menu.GetItem(index);
                    menuItem.SetIcon(GetIconDrawable(icon));
                }
                else
                {
                    TabLayout.Tab tab = _tabLayout.GetTabAt(index);
                    SetTabIcon(tab, icon);
                }
            }
        }
        void TabLayoutMediator.ITabConfigurationStrategy.OnConfigureTab(TabLayout.Tab tab, int position)
        {
            var title = host.GetPageTitle(position);

            tab.SetText(title);
        }
Exemplo n.º 11
0
 void TabLayoutMediator.ITabConfigurationStrategy.OnConfigureTab(TabLayout.Tab p0, int p1)
 {
     p0.SetText(_tabbedPageManager.Element.Children[p1].Title);
 }
Exemplo n.º 12
0
 void TabLayoutMediator.ITabConfigurationStrategy.OnConfigureTab(TabLayout.Tab tab, int position)
 {
     tab.SetText(new String(SectionController.GetItems()[position].Title));
 }
Exemplo n.º 13
0
 protected override void SetTabIconImageSource(TabLayout.Tab tab, Drawable icon)
 {
     base.SetTabIconImageSource(tab, icon);
     tab.SetText("");
 }