Example #1
0
 public void GoBack()
 {
     if (CurrentActivity != null)
     {
         CurrentActivity.Finish();
     }
 }
 public virtual bool ClosePlatformViews()
 {
     CloseFragments();
     if (!(CurrentActivity is MvxFormsAppCompatActivity || CurrentActivity is MvxFormsApplicationActivity) &&
         !(CurrentActivity is MvxSplashScreenActivity || CurrentActivity is MvxSplashScreenAppCompatActivity))
     {
         CurrentActivity.Finish();
     }
     return(true);
 }
Example #3
0
        public virtual ValueTask <bool> ClosePlatformViews()
        {
            CloseFragments();
            if (!(CurrentActivity is MvxFormsAppCompatActivity || CurrentActivity is MvxFormsApplicationActivity) &&
                !(CurrentActivity is MvxSplashScreenActivity))
            {
                CurrentActivity?.Finish();
            }

            return(new ValueTask <bool>(true));
        }
Example #4
0
        protected virtual bool CloseActivity(IMvxViewModel viewModel, MvxActivityPresentationAttribute attribute)
        {
            var currentView = CurrentActivity as IMvxView;

            if (currentView == null)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe has no current page");
                return(false);
            }

            if (currentView.ViewModel != viewModel)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe's current page is not the view for the requested viewmodel");
                return(false);
            }

            CurrentActivity.Finish();

            return(true);
        }
        protected virtual Task <bool> CloseActivity(IMvxViewModel viewModel, MvxActivityPresentationAttribute attribute)
        {
            var currentView = CurrentActivity as IMvxView;

            if (currentView == null)
            {
                MvxLog.Instance.Warn("Ignoring close for viewmodel - rootframe has no current page");
                return(Task.FromResult(false));
            }

            if (currentView.ViewModel != viewModel)
            {
                MvxLog.Instance.Warn("Ignoring close for viewmodel - rootframe's current page is not the view for the requested viewmodel");
                return(Task.FromResult(false));
            }

            CurrentActivity.Finish();

            return(Task.FromResult(true));
        }
        protected override Task <bool> CloseFragment(IMvxViewModel viewModel, MvxFragmentPresentationAttribute attribute)
        {
            // try to close nested fragment first
            if (attribute.FragmentHostViewType != null)
            {
                var fragmentHost = GetFragmentByViewType(attribute.FragmentHostViewType);
                if (fragmentHost != null &&
                    TryPerformCloseFragmentTransaction(fragmentHost.ChildFragmentManager, attribute))
                {
                    return(Task.FromResult(true));
                }
            }

            // Close fragment. If it isn't successful, then close the current Activity
            if (TryPerformCloseFragmentTransaction(CurrentFragmentManager, attribute))
            {
                return(Task.FromResult(true));
            }

            CurrentActivity.Finish();
            return(Task.FromResult(true));
        }