Ejemplo n.º 1
0
        protected virtual void UpdateFlyoutFooter()
        {
            if (_footerView != null)
            {
                var oldFooterView = _footerView;
                _rootView.RemoveView(_footerView);
                _footerView        = null;
                oldFooterView.View = null;
            }

            var footer = ((IShellController)_shellContext.Shell).FlyoutFooter;

            if (footer == null)
            {
                return;
            }

            if (_flyoutWidth == 0)
            {
                return;
            }

            _footerView = new ContainerView(_shellContext.AndroidContext, footer, MauiContext)
            {
                MatchWidth = true
            };

            var footerViewLP = new CoordinatorLayout.LayoutParams(0, 0)
            {
                Gravity = (int)(GravityFlags.Bottom | GravityFlags.End)
            };

            UpdateFooterLayout(footerViewLP);
            _rootView.AddView(_footerView, footerViewLP);

            UpdateContentPadding();
        }
Ejemplo n.º 2
0
        public override AView GetView(int position, AView convertView, ViewGroup parent)
        {
            var item = ListProxy[position];

            ContainerView result = null;

            if (convertView != null)
            {
                result = convertView as ContainerView;
                result.View.BindingContext = item;
            }
            else
            {
                var template = _searchHandler.ItemTemplate ?? DefaultTemplate;
                var view     = (View)template.CreateContent(item, _shellContext.Shell);
                view.BindingContext = item;

                result               = new ContainerView(parent.Context, view, MauiContext);
                result.MatchWidth    = true;
                result.MeasureHeight = true;
            }

            return(result);
        }
Ejemplo n.º 3
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                Disconnect();

                if (_appBar != null)
                {
                    _appBar.RemoveOnOffsetChangedListener(this);

                    if (_headerFrameLayout != null)
                    {
                        _appBar.RemoveView(_headerFrameLayout);
                    }
                }

                if (_rootView != null && _footerView != null)
                {
                    _rootView.RemoveView(_footerView);
                }

                if (View != null && View is ShellFlyoutLayout sfl)
                {
                    sfl.LayoutChanging -= OnFlyoutViewLayoutChanging;
                }

                if (_headerView != null)
                {
                    _headerView.LayoutChange -= OnHeaderViewLayoutChange;
                }

                if (_contentView != null)
                {
                    _contentView.View = null;
                }

                _flyoutContentView?.Dispose();
                _headerView?.Dispose();

                _rootView?.Dispose();
                _defaultBackgroundColor?.Dispose();
                _bgImage?.Dispose();

                _contentView            = null;
                _rootView               = null;
                _headerView             = null;
                _shellContext           = null;
                _appBar                 = null;
                _flyoutContentView      = null;
                _defaultBackgroundColor = null;
                _bgImage                = null;
                _footerView             = null;
            }

            base.Dispose(disposing);
        }