Load a Popup Page with a gif while pushing a page stops its movement - Xamarin Forms

Viewed 222

I am trying to push a page that is a TabbedPage with 3 tabs that are pages with SfSchedule (a SyncFusion control that take a bit to load). Becouse it takes long to load, I am using the Rg.Plugins.Popup plugin to push a modal page with a GIF(some characters moving). The problem is that while the TabbedPage is being pushed, the gif stops moving, and once it loads it keeps moving. I have tried to use another thread to instantiate the page but becouse I have to end up using Device.BeginInvokeOnMainThread to push the page it blocks the gif movement anyway. Also I got to instantiate the page in another thread and then push it using Device.BeginInvokeOnMainThread and what takes time is pushing the page, not instantiating it.

The method that pushes the page and the Popup:

public async void Navegar(Type page)
        {
            _tipoPagina = page;
            await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new LoadingPopUp());
            var pagina = (Page)Activator.CreateInstance(_tipoPagina);
            await ((NavigationPage)this.Detail).PushAsync(pagina);
            await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAllAsync();
        }

The Popup page:

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage
        xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
        xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:d="http://xamarin.com/schemas/2014/forms/design"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        x:Class="XXXXX.LoadingPopUp">
    <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="White">
        <Image VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" Source="loading.gif" IsAnimationPlaying="True"></Image>
    </StackLayout>
</pages:PopupPage>

The Page that takes a long time to push:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:plugin="clr-namespace:Plugin.Badge.Abstractions;assembly=Plugin.Badge.Abstractions"
            xmlns:calendario_vistas="clr-namespace:XXXXX.Calendario_Vistas"
            mc:Ignorable="d"
            x:Class="XXXXX.Calendario"
            Title="Calendario"
            NavigationPage.HasNavigationBar="False">
    <TabbedPage.Children>
        <NavigationPage Title="Día">
            <NavigationPage.IconImageSource>
                <FontImageSource FontFamily="{StaticResource FASolido}" Glyph="&#xf783;" Size="45"></FontImageSource>
            </NavigationPage.IconImageSource>
            <x:Arguments>
                <calendario_vistas:CalendarioDiario plugin:TabBadge.BadgeText="3"></calendario_vistas:CalendarioDiario>
            </x:Arguments>
        </NavigationPage>
        <NavigationPage Title="Semanal">
            <NavigationPage.IconImageSource>
                <FontImageSource FontFamily="{StaticResource FASolido}" Glyph="&#xf784;" Size="45"></FontImageSource>
            </NavigationPage.IconImageSource>
            <x:Arguments>
                <calendario_vistas:CalendarioSemanal plugin:TabBadge.BadgeText="10"></calendario_vistas:CalendarioSemanal>
            </x:Arguments>
        </NavigationPage>
        <NavigationPage Title="Listado">
            <NavigationPage.IconImageSource>
                <FontImageSource FontFamily="{StaticResource FASolido}" Glyph="&#xf073;" Size="45"></FontImageSource>
            </NavigationPage.IconImageSource>
            <x:Arguments>
                <calendario_vistas:CalendarioLista></calendario_vistas:CalendarioLista>
            </x:Arguments>
        </NavigationPage>
    </TabbedPage.Children>
</TabbedPage>

Any help is appreciated. Thank You.

P.D.: I just realised, if I use the ActivityIndicator, it stays moving all the time, it doesn't stop. With the activity indicator it works perfect. I just can't get it to play the gif without stopping. P.D.2: I posted this twice on Xamarin Forms forums and got no answers :(

0 Answers
Related