Exemplo n.º 1
0
        void SetLabeledBy()
        {
            if (Element == null || Control == null)
            {
                return;
            }

            var elemValue = (VisualElement)Element.GetValue(Accessibility.LabeledByProperty);

            if (elemValue != null)
            {
                var id = Control.Id;
                if (id == -1)
                {
                    id = Control.Id = FormsAppCompatActivity.GetUniqueId();
                }

                var renderer = elemValue?.GetRenderer();
                renderer?.SetLabelFor(id);
            }
        }
Exemplo n.º 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <CarouselPage> e)
        {
            base.OnElementChanged(e);

            var activity = (FormsAppCompatActivity)Context;

            if (e.OldElement != null)
            {
                ((IPageController)e.OldElement).InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
            }

            if (e.NewElement != null)
            {
                FormsViewPager pager =
                    _viewPager =
                        new FormsViewPager(activity)
                {
                    OverScrollMode   = OverScrollMode.Never,
                    EnableGesture    = true,
                    LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent),
                    Adapter          = new FormsFragmentPagerAdapter <ContentPage>(e.NewElement, activity.SupportFragmentManager)
                    {
                        CountOverride = e.NewElement.Children.Count
                    }
                };
                pager.Id = FormsAppCompatActivity.GetUniqueId();
                pager.AddOnPageChangeListener(this);

                ViewGroup.AddView(pager);
                CarouselPage carouselPage = e.NewElement;
                if (carouselPage.CurrentPage != null)
                {
                    ScrollToCurrentPage();
                }

                ((IPageController)carouselPage).InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
            }
        }
Exemplo n.º 3
0
 public NavigationPageRenderer()
 {
     AutoPackage = false;
     Id          = FormsAppCompatActivity.GetUniqueId();
     Device.Info.PropertyChanged += DeviceInfoPropertyChanged;
 }
Exemplo n.º 4
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);

            var activity = (FormsAppCompatActivity)Context;

            if (e.OldElement != null)
            {
                ((IPageController)e.OldElement).InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
            }

            if (e.NewElement != null)
            {
                if (_tabLayout == null)
                {
                    TabLayout tabs;
                    if (FormsAppCompatActivity.TabLayoutResource > 0)
                    {
                        tabs = _tabLayout = activity.LayoutInflater.Inflate(FormsAppCompatActivity.TabLayoutResource, null).JavaCast <TabLayout>();
                    }
                    else
                    {
                        tabs = _tabLayout = new TabLayout(activity)
                        {
                            TabMode = TabLayout.ModeFixed, TabGravity = TabLayout.GravityFill
                        }
                    };
                    FormsViewPager pager =
                        _viewPager =
                            new FormsViewPager(activity)
                    {
                        OverScrollMode   = OverScrollMode.Never,
                        EnableGesture    = UseAnimations,
                        LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent),
                        Adapter          = new FormsFragmentPagerAdapter <Page>(e.NewElement, FragmentManager)
                        {
                            CountOverride = e.NewElement.Children.Count
                        }
                    };
                    pager.Id = FormsAppCompatActivity.GetUniqueId();
                    pager.AddOnPageChangeListener(this);

                    AddView(pager);
                    AddView(tabs);

                    OnChildrenCollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                }

                TabbedPage tabbedPage = e.NewElement;
                if (tabbedPage.CurrentPage != null)
                {
                    ScrollToCurrentPage();
                }

                ((IPageController)tabbedPage).InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
                UpdateBarBackgroundColor();
                UpdateBarTextColor();
                UpdateSwipePaging();
                UpdateOffscreenPageLimit();
            }
        }
 public MasterDetailContainer(MasterDetailPage parent, bool isMaster, Context context) : base(parent, isMaster, context)
 {
     Id        = FormsAppCompatActivity.GetUniqueId();
     _parent   = parent;
     _isMaster = isMaster;
 }