private void PrepareToSwitch(IXPage page, IPageAnimation animation, bool isPop) { Context.HideKeyboard(this); CancelCurrentAnimation(); ((isPop ? _currentPage.XamarinPage : page.XamarinPage) as IAnimationPage)?.OnAnimationStarted(isPop); SetNavAnimationInProgress(true); page.SetUIParams(animation.GetStartUIForAppearingPage(isPop)); _currentPage.SetUIParams(animation.GetStartUIForDisappearingPage(isPop)); }
private Task <bool> SwitchPageAsync(IXPage xPage, bool isPop) { Context.HideKeyboard(this); CancelCurrentAnimation(); ProcessPageAppearing(xPage, isPop); ProcessPageDisappearing(isPop); _currentPage = xPage; return(Task.FromResult(true)); }
protected override Task <bool> OnPushAsync(Page view, bool animated) { if (_currentPage == null) // process root page in NavigationStack { _currentPage = view.GetXPage(); ProcessPageAppearing(_currentPage, false); return(Task.FromResult(true)); } return(SwitchContentAsync(view, AnimationNavigationPage.GetAnimation(view, animated), false)); }
private Task <bool> SwitchAnimationPageAsync(IXPage xPage, IPageAnimation animation, bool isPop) { PrepareToSwitch(xPage, animation, isPop); _tcs = new TaskCompletionSource <bool>(); if (animation.Type == AnimationType.Flip) { _currentAnimations.Add(_currentPage.GetDroidAnimation(animation, animation.GetEndUIForDisappearingPage(isPop), () => OnNewPageIsAppearing(xPage, animation, isPop), isPop)); } else { OnNewPageIsAppearing(xPage, animation, isPop); } return(_tcs.Task); }
private void ProcessPageAppearing(IXPage page, bool isPop) { if (page.GetParent() != this) { page.AddToNavigationRenderer(this); } else { page.SendAppearing(); } if (!isPop && page.IsNeedToForceLayout) { Element.ForceLayout(); } page.SetVisibility(ViewStates.Visible); }
private void OnNewPageIsAppearing(IXPage xPage, IPageAnimation animation, bool isPop) { ProcessPageAppearing(xPage, isPop); var pageForAnimation = animation.Type != AnimationType.Flip && isPop ? _currentPage : xPage; var paramsForAnimation = animation.GetEndUIParamsWhenNewPageIsAppearing(isPop); _currentAnimations.Add(pageForAnimation.GetDroidAnimation(animation, paramsForAnimation, () => { ((isPop ? _currentPage.XamarinPage : xPage.XamarinPage) as IAnimationPage)?.OnAnimationFinished(isPop); ProcessPageDisappearing(isPop); _currentPage = xPage; _tcs.TrySetResult(true); }, isPop)); if (animation.Type == AnimationType.Push) { var animPage = isPop ? xPage : _currentPage; var animParams = isPop ? animation.GetEndUIForAppearingPage(isPop) : animation.GetEndUIForDisappearingPage(isPop); _currentAnimations.Add(animPage.GetDroidAnimation(animation, animParams, null, isPop)); } }