<?xml version="1.0" encoding="UTF-8"?>
<u:AdaptedPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:u="clr-namespace:Pixiview.UI"
               xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
               x:Class="Pixiview.Illust.ViewIllustPage"
               ios:Page.UseSafeArea="False"
               Shell.TabBarIsVisible="False"
               BackgroundColor="{DynamicResource WindowColor}">
    <ContentPage.ToolbarItems>
        <ToolbarItem Order="Primary" Clicked="Favorite_Clicked"
                     IconImageSource="{Binding FavoriteIcon}"/>
        <ToolbarItem Order="Primary" Clicked="Refresh_Clicked"
                     IconImageSource="{DynamicResource FontIconRefresh}"/>
        <ToolbarItem Order="Primary" Clicked="More_Clicked"
                     IconImageSource="{DynamicResource FontIconMore}"/>
    </ContentPage.ToolbarItems>
    <Grid RowSpacing="0">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <CarouselView ItemsSource="{Binding Illusts}" HorizontalScrollBarVisibility="Never"
                      Position="{Binding CurrentPage}"
                      ItemTemplate="{StaticResource carouselView}"
                      IsScrollAnimated="{Binding IsScrollAnimated}">
            <CarouselView.ItemsLayout>
                <LinearItemsLayout Orientation="Vertical" ItemSpacing="20"/>
            </CarouselView.ItemsLayout>
        </CarouselView>

        <Grid Margin="{Binding PageTopMargin}" VerticalOptions="Start">
            <ProgressBar x:Name="progress" IsVisible="{Binding ProgressVisible}"
                         Progress="0.05">
                <ProgressBar.Margin>
                    <OnPlatform x:TypeArguments="Thickness" Android="0, -6, 0, 0"/>
                </ProgressBar.Margin>
            </ProgressBar>
        </Grid>

        <Grid Margin="{Binding PageTopMargin}" IsVisible="{Binding IsPageVisible}"
              HorizontalOptions="End" VerticalOptions="Start">
            <u:RoundLabel Text="{Binding PagePositionText}"
                          BackgroundColor="{DynamicResource MaskColor}" Margin="0, 6, 6, 0"
                          Padding="6, 4" CornerRadius="6"
                          FontSize="Micro" TextColor="White"/>
        </Grid>

        <u:RoundLabel Text="{Binding AnimeStatus}"
                      BackgroundColor="{DynamicResource MaskColor}" Margin="0, 0, 6, 6"
                      Padding="13, 12, 0, 0" CornerRadius="22"
                      WidthRequest="44" HeightRequest="44"
                      HorizontalOptions="End" VerticalOptions="End"
                      FontFamily="{DynamicResource IconSolidFontFamily}"
                      FontSize="20" TextColor="White"
                      IsVisible="{Binding IsAnimateSliderVisible}"/>

        <Slider Grid.Row="1" VerticalOptions="End"
                Margin="{DynamicResource ScreenBottomPadding}"
                MinimumTrackColor="{DynamicResource TintColor}"
                IsEnabled="{Binding IsAnimateSliderEnabled}"
                IsVisible="{Binding IsAnimateSliderVisible}"
                Value="{Binding CurrentAnimeFrame, Mode=TwoWay}"
                Maximum="{Binding MaximumFrame}"/>
    </Grid>
</u:AdaptedPage>
