Exemple #1
0
        protected override IMvxAndroidViewPresenter CreateViewPresenter()
        {
            var mvxFragmentsPresenter = new MvxFragmentsPresenter(AndroidViewAssemblies);

            Mvx.RegisterSingleton <IMvxAndroidViewPresenter>(mvxFragmentsPresenter);

            mvxFragmentsPresenter.AddPresentationHintHandler <MvxPanelPopToRootPresentationHint>(hint =>
            {
                var activity         = Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity;
                var fragmentActivity = activity as Android.Support.V4.App.FragmentActivity;

                for (int i = 0; i < fragmentActivity.SupportFragmentManager.BackStackEntryCount; i++)
                {
                    fragmentActivity.SupportFragmentManager.PopBackStack();
                }

                return(true);
            });
            Mvx.RegisterSingleton <MvxPresentationHint>(() => new MvxPanelPopToRootPresentationHint());
            return(mvxFragmentsPresenter);
        }
Exemple #2
0
        protected override IMvxAndroidViewPresenter CreateViewPresenter()
        {
            MvxFragmentsPresenter mvxFragmentsPresenter = new MvxFragmentsPresenter(this.AndroidViewAssemblies);

            Mvx.RegisterSingleton <IMvxAndroidViewPresenter>(mvxFragmentsPresenter);

            //add a presentation hint handler to listen for pop to root
            mvxFragmentsPresenter.AddPresentationHintHandler <MvxPanelPopToRootPresentationHint>(hint =>
            {
                Activity activity = Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity;
                FragmentActivity fragmentActivity = activity as FragmentActivity;

                for (int i = 0; i < fragmentActivity.SupportFragmentManager.BackStackEntryCount; i++)
                {
                    fragmentActivity.SupportFragmentManager.PopBackStack();
                }
                return(true);
            });
            //register the presentation hint to pop to root
            //picked up in the third view model
            Mvx.RegisterSingleton <MvxPresentationHint>(() => new MvxPanelPopToRootPresentationHint());
            return(mvxFragmentsPresenter);
        }