AView CreateFlyoutContent(ViewGroup rootView) { _rootView = rootView; if (_contentView != null) { var oldContentView = _contentView; _contentView = null; oldContentView.TearDown(); } var content = ((IShellController)ShellContext.Shell).FlyoutContent; if (content == null) { var lp = new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent); lp.Behavior = new AppBarLayout.ScrollingViewBehavior(); var context = ShellContext.AndroidContext; Profile.FramePartition("Recycler.SetAdapter"); var recyclerView = new RecyclerViewContainer(context, new ShellFlyoutRecyclerAdapter(ShellContext, OnElementSelected)) { LayoutParameters = lp }; return(recyclerView); } _contentView = new ShellContentView(ShellContext.AndroidContext, content, MauiContext); _contentView.NativeView.LayoutParameters = new CoordinatorLayout.LayoutParams(LP.MatchParent, LP.MatchParent) { Behavior = new AppBarLayout.ScrollingViewBehavior() }; return(_contentView.NativeView); }
protected virtual void UpdateFlyoutFooter() { if (_footerView != null) { var oldFooterView = _footerView; _rootView.RemoveView(_footerView.NativeView); _footerView = null; oldFooterView.TearDown(); } var footer = ((IShellController)_shellContext.Shell).FlyoutFooter; if (footer == null) { return; } _footerView = new ShellContentView(_shellContext.AndroidContext, footer, MauiContext); _rootView.AddView(_footerView.NativeView); if (_footerView.NativeView.LayoutParameters is CoordinatorLayout.LayoutParams cl) { cl.Gravity = (int)(GravityFlags.Bottom | GravityFlags.End); } UpdateFooterLayout(); UpdateContentLayout(); UpdateContentBottomMargin(); }
protected override void Dispose(bool disposing) { if (_disposed) { return; } _disposed = true; if (disposing) { _shellContext.Shell.PropertyChanged -= OnShellPropertyChanged; if (_flyoutHeader != null) { _flyoutHeader.MeasureInvalidated -= OnFlyoutHeaderMeasureInvalidated; } if (_appBar != null) { _appBar.RemoveOnOffsetChangedListener(this); _appBar.RemoveView(_headerView); } if (_rootView != null && _footerView?.NativeView != null) { _rootView.RemoveView(_footerView.NativeView); } if (View != null && View is ShellFlyoutLayout sfl) { sfl.LayoutChanging -= OnFlyoutViewLayoutChanged; } _contentView?.TearDown(); _flyoutContentView?.Dispose(); _headerView.Dispose(); _footerView?.TearDown(); _rootView.Dispose(); _defaultBackgroundColor?.Dispose(); _bgImage?.Dispose(); _contentView = null; _flyoutHeader = null; _rootView = null; _headerView = null; _shellContext = null; _appBar = null; _flyoutContentView = null; _defaultBackgroundColor = null; _bgImage = null; _footerView = null; } base.Dispose(disposing); }
protected virtual void OnViewSet(View view) { if (_shellContentView == null) { _shellContentView = new ShellContentView(this.Context, view, _mauiContext); } else { _shellContentView.OnViewSet(view); } if (_shellContentView.NativeView != null) { AddView(_shellContentView.NativeView); } }