public async Task Apply(GalleyBaseView view, GalleySuperView superView)
        {
            var oldViewIndex = superView.Children.ToArray().IndexOf(superView.CurrentView);

            superView.InsertChildIfNeeded(0, view, !superView.IsAllowedMakingViewsInvisible);
            await superView.SetCurrentView(view, true);

            var newViewIndex = superView.Children.ToArray().IndexOf(superView.CurrentView);

            Task animationTask;

            if (newViewIndex > oldViewIndex)
            {
                view.Opacity   = 0;
                view.IsVisible = true;
                animationTask  = Task.Run(async() => await view.FadeTo(1, _time));
            }
            else
            {
                view.Opacity   = 1;
                view.IsVisible = true;
                animationTask  = superView.GetOtherVisibleViews(view).EachAsync(async c => await c.FadeTo(0, _time), false);
            }

            await superView.ResetFloatingControls(view, animationTask);

            superView.SetSuperView(view);
        }
        public async Task Apply(GalleyBaseView view, GalleySuperView superView)
        {
            superView.InsertChildIfNeeded(0, view);
            await superView.SetCurrentView(view, true);

            await superView.ResetFloatingControls(view, superView.GetOtherVisibleViews(view)
                                                  .EachAsync(async c => await c.LayoutTo(superView.Width, 0, superView.Width, superView.Height, _time)));

            superView.SetSuperView(view);
        }
Esempio n. 3
0
        public async Task Apply(GalleyBaseView view, GalleySuperView superView)
        {
            view.Opacity = 0;
            superView.Children.Add(view);
            view.Layout(superView.Width, superView.Height, superView.Width, superView.Height);
            view.Opacity = 1;
            await superView.ResetFloatingControls(view, view.LayoutTo(0, 0, superView.Width, superView.Height, 500, Easing.Linear));

            await superView.SetCurrentView(view);

            superView.SetSuperView(view);
        }
        public async Task Apply(GalleyBaseView view, GalleySuperView superView)
        {
            view.WidthRequest  = superView.Width;
            view.HeightRequest = superView.Height;
            view.TranslationX  = superView.Width;
            superView.InsertChildIfNeeded(superView.Children.Count, view);

            var pushTcs = new TaskCompletionSource <bool>();

            new Animation((v) => view.TranslationX = v, superView.Width, 0)
            .Commit(view, "pushAnimation", 16, _time, Easing.Linear, async(v, b) =>
            {
                await superView.SetCurrentView(view);
                superView.SetSuperView(view);
                pushTcs.SetResult(true);
            });

            await superView.ResetFloatingControls(view, pushTcs.Task);
        }