Beispiel #1
0
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            _parent = container ?? _parent;

            if (Page != null)
            {
                _pageContainer = Page?.Handler?.NativeView as AView;

                if (_pageContainer == null)
                {
                    var scopedContext =
                        _mauiContext.MakeScoped(inflater, ChildFragmentManager);

                    _pageContainer = Page.ToNative(scopedContext);
                    _viewhandler   = (INativeViewHandler)Page.Handler;
                }
                else
                {
                    _parent = _parent ?? (_pageContainer.Parent as ViewGroup);
                }

                _onCreateCallback?.Invoke(_pageContainer);

                return(_pageContainer);
            }

            return(null);
        }
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            _page = ((IShellContentController)ShellContentTab).GetOrCreateContent();

            IMauiContext mauiContext = null;

            // If the page has already been created with a handler then we just let it retain the same
            // Handler and MauiContext
            // But we want to update the inflater and ChildFragmentManager to match
            // the handlers new home
            if (_page.Handler?.MauiContext is MauiContext scopedMauiContext)
            {
                // If this page comes to us from a different activity then don't reuse it
                // disconnect the handler so it can recreate against new MauiContext
                if (scopedMauiContext.GetActivity() == Context.GetActivity())
                {
                    scopedMauiContext.AddWeakSpecific(ChildFragmentManager);
                    scopedMauiContext.AddWeakSpecific(inflater);
                    mauiContext = scopedMauiContext;
                }
                else
                {
                    _page.Handler.DisconnectHandler();
                }
            }

            mauiContext ??= _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager);

            return(new ShellPageContainer(RequireContext(), (IPlatformViewHandler)_page.ToHandler(mauiContext), true)
            {
                LayoutParameters = new LP(LP.MatchParent, LP.MatchParent)
            });
        }
Beispiel #3
0
            public override AView OnCreateView(ALayoutInflater inflater, AViewGroup container, Bundle savedInstanceState)
            {
                ScopedMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager, registerNewNavigationRoot: true);
                _ = _window.ToHandler(ScopedMauiContext);
                var rootView = ScopedMauiContext.GetNavigationRootManager().RootView;

                rootView.LayoutParameters = new LinearLayoutCompat.LayoutParams(500, 500);
                return(rootView);
            }
Beispiel #4
0
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            _page = ((IShellContentController)ShellContentTab).GetOrCreateContent();

            var pageMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager);

            return(new ShellPageContainer(RequireContext(), (IPlatformViewHandler)_page.ToHandler(pageMauiContext), true)
            {
                LayoutParameters = new LP(LP.MatchParent, LP.MatchParent)
            });
        }
Beispiel #5
0
        public StackNavigationManager(IMauiContext mauiContext)
        {
            var currentInflater = mauiContext.GetLayoutInflater();
            var inflater        =
                new StackLayoutInflater(
                    currentInflater,
                    currentInflater.Context,
                    this);

            MauiContext =
                mauiContext.MakeScoped(inflater, context: inflater.Context);
        }
        public override void SetMauiContext(IMauiContext mauiContext)
        {
            var currentInflater = mauiContext.GetLayoutInflater();
            var inflater        =
                new StackNavigationManager.StackLayoutInflater(
                    currentInflater,
                    currentInflater.Context,
                    CreateNavigationManager());

            mauiContext =
                mauiContext.MakeScoped(inflater, context: inflater.Context);

            base.SetMauiContext(mauiContext);
        }
            public override AView OnCreateView(ALayoutInflater inflater, AViewGroup container, Bundle savedInstanceState)
            {
                ScopedMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager, registerNewNavigationRoot: true);
                var handler = (WindowHandlerStub)_window.ToHandler(ScopedMauiContext);

                var decorView = RequireActivity().Window.DecorView;

                handler.PlatformViewUnderTest.LayoutParameters = new FitWindowsFrameLayout.LayoutParams(AViewGroup.LayoutParams.MatchParent, AViewGroup.LayoutParams.MatchParent);

                FakeActivityRootView = new FakeActivityRootView(ScopedMauiContext.Context);
                FakeActivityRootView.LayoutParameters = new LinearLayoutCompat.LayoutParams(AViewGroup.LayoutParams.MatchParent, AViewGroup.LayoutParams.MatchParent);
                FakeActivityRootView.AddView(handler.PlatformViewUnderTest);

                return(FakeActivityRootView);
            }
Beispiel #8
0
            public override AView OnCreateView(ALayoutInflater inflater, AViewGroup container, Bundle savedInstanceState)
            {
                ScopedMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager, registerNewNavigationRoot: true);
                _ = _window.ToHandler(ScopedMauiContext);

                var rootView  = ScopedMauiContext.GetNavigationRootManager().RootView;
                var decorView = RequireActivity().Window.DecorView;

                rootView.LayoutParameters = new LinearLayoutCompat.LayoutParams(decorView.MeasuredWidth, decorView.MeasuredHeight);

                FakeActivityRootView = new FakeActivityRootView(ScopedMauiContext.Context);
                FakeActivityRootView.LayoutParameters = new LinearLayoutCompat.LayoutParams(decorView.MeasuredWidth, decorView.MeasuredHeight);
                FakeActivityRootView.AddView(rootView);

                return(FakeActivityRootView);
            }
Beispiel #9
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup?container, Bundle?savedInstanceState)
        {
            var pageMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager);

            return(DetailView.ToPlatform(pageMauiContext));
        }
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     ScopedMauiContext = _mauiContext.MakeScoped(layoutInflater: inflater, fragmentManager: ChildFragmentManager, registerNewNavigationRoot: true);
     return(ScopedMauiContext.GetNavigationRootManager().RootView);
 }