Files
BookReader/BookReader/Views/ReaderPage.xaml
Курнат Андрей 45382570d9 edit
2026-02-16 05:52:43 +03:00

154 lines
7.0 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:BookReader.ViewModels"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:converters="clr-namespace:BookReader.Converters"
x:Class="BookReader.Views.ReaderPage"
x:DataType="vm:ReaderViewModel"
Shell.NavBarIsVisible="False"
NavigationPage.HasNavigationBar="False">
<ContentPage.Resources>
<toolkit:InvertedBoolConverter x:Key="InvertedBoolConverter" />
</ContentPage.Resources>
<Grid>
<!-- HybridWebView for book rendering -->
<HybridWebView x:Name="ReaderWebView"
RawMessageReceived="OnRawMessageReceived"
DefaultFile="index.html"
HorizontalOptions="Fill"
VerticalOptions="Fill" />
<VerticalStackLayout VerticalOptions="End"
HorizontalOptions="Center"
Padding="10"
InputTransparent="True">
<Frame BackgroundColor="#AA000000"
CornerRadius="15"
Padding="10,2"
BorderColor="Transparent"
HasShadow="False">
<Label Text="{Binding ChapterProgressText}"
TextColor="White"
FontSize="12"
HorizontalTextAlignment="Center" />
</Frame>
</VerticalStackLayout>
<!-- Overlay Menu -->
<Grid IsVisible="{Binding IsMenuVisible}"
BackgroundColor="#88000000"
InputTransparent="False">
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding HideMenuCommand}" />
</Grid.GestureRecognizers>
<!--Menu Panel-->
<Frame VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="320"
BackgroundColor="#2C2C2C"
CornerRadius="16"
Padding="20"
HasShadow="True"
BorderColor="Transparent">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnMenuPanelTapped" />
</Frame.GestureRecognizers>
<VerticalStackLayout Spacing="15">
<!--Title-->
<Label Text="Reading Settings"
FontSize="18"
FontAttributes="Bold"
TextColor="White"
HorizontalOptions="Center" />
<!--Font Size-->
<VerticalStackLayout Spacing="5">
<Label Text="Font Size"
FontSize="14"
TextColor="#B0B0B0" />
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="10">
<Button Grid.Column="0"
Text="A-"
FontSize="14"
WidthRequest="45"
HeightRequest="40"
BackgroundColor="#444"
TextColor="White"
CornerRadius="8"
Clicked="OnDecreaseFontSize" />
<Label Grid.Column="1"
Text="{Binding FontSize, StringFormat='{0}px'}"
FontSize="16"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Button Grid.Column="2"
Text="A+"
FontSize="14"
WidthRequest="45"
HeightRequest="40"
BackgroundColor="#444"
TextColor="White"
CornerRadius="8"
Clicked="OnIncreaseFontSize" />
</Grid>
</VerticalStackLayout>
<!--Font Family-->
<VerticalStackLayout Spacing="5">
<Label Text="Font Family"
FontSize="14"
TextColor="#B0B0B0" />
<Picker x:Name="FontFamilyPicker"
ItemsSource="{Binding AvailableFonts}"
SelectedItem="{Binding FontFamily}"
TextColor="White"
BackgroundColor="#444"
FontSize="14"
SelectedIndexChanged="OnFontFamilyChanged" />
</VerticalStackLayout>
<!--Chapters Button-->
<Button Text="📑 Chapters"
BackgroundColor="#5D4037"
TextColor="White"
FontSize="14"
CornerRadius="8"
HeightRequest="45"
Command="{Binding ToggleChapterListCommand}" />
<!--Chapter List-->
<CollectionView ItemsSource="{Binding Chapters}"
IsVisible="{Binding IsChapterListVisible}"
MaximumHeightRequest="200"
SelectionMode="Single"
SelectionChanged="OnChapterSelected">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="x:String">
<Grid Padding="10,8" BackgroundColor="Transparent">
<Label Text="{Binding .}"
TextColor="#E0E0E0"
FontSize="13"
LineBreakMode="TailTruncation" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<!--Back Button-->
<Button Text="← Back to Library"
BackgroundColor="#D32F2F"
TextColor="White"
FontSize="14"
CornerRadius="8"
HeightRequest="45"
Clicked="OnBackToLibrary" />
</VerticalStackLayout>
</Frame>
</Grid>
</Grid>
</ContentPage>