Esempio n. 1
0
        void UpdateTitleIcon()
        {
            Page currentPage = Element.CurrentPage;

            if (currentPage == null)
            {
                return;
            }

            ImageSource source = NavigationPage.GetTitleIconImageSource(currentPage);

            if (source == null || source.IsEmpty)
            {
                _toolbar.RemoveView(_titleIconView);
                _titleIconView?.Dispose();
                _titleIconView = null;
                _imageSource   = null;
                return;
            }

            if (_titleIconView == null)
            {
                _titleIconView = new ImageView(Context);
                _toolbar.AddView(_titleIconView, 0);
            }

            if (_imageSource != source)
            {
                _imageSource = source;
                _titleIconView.SetImageResource(global::Android.Resource.Color.Transparent);
                _ = this.ApplyDrawableAsync(currentPage, NavigationPage.TitleIconImageSourceProperty, Context, drawable =>
                {
                    _titleIconView.SetImageDrawable(drawable);
                    AutomationPropertiesProvider.AccessibilitySettingsChanged(_titleIconView, source);
                });
            }
        }
Esempio n. 2
0
        void OnTabLayoutChange(object sender, AView.LayoutChangeEventArgs e)
        {
            if (_disposed)
            {
                return;
            }

            var items = SectionController.GetItems();

            for (int i = 0; i < _tablayout.TabCount; i++)
            {
                if (items.Count <= i)
                {
                    break;
                }

                var tab = _tablayout.GetTabAt(i);

                if (tab.View != null)
                {
                    AutomationPropertiesProvider.AccessibilitySettingsChanged(tab.View, items[i]);
                }
            }
        }