1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00

Ajustements tailles, corrections bookmarks

This commit is contained in:
Yan Maniez 2018-09-19 22:18:45 +02:00
parent f8f43f049f
commit c20ec74840
11 changed files with 59 additions and 122 deletions

View file

@ -135,6 +135,8 @@
<Content Include="funnel.png" />
<Content Include="icon.png" />
<Content Include="ic_launcher.png" />
<Content Include="plain_arrow_down.png" />
<Content Include="plain_arrow_up.png" />
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-100.png" />
<Content Include="Assets\LockScreenLogo.scale-125.png" />
@ -171,6 +173,7 @@
<Content Include="settings_knobs.png" />
<Content Include="spell_book.png" />
<Content Include="stars_stack.png" />
<Content Include="trash_can.png" />
<Content Include="wooden_sign.png" />
<Content Include="xamarin_logo.png" />
</ItemGroup>

View file

@ -346,9 +346,6 @@
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Views\BookmarksEditPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\BookmarksPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>

View file

@ -102,20 +102,20 @@
<!-- MarkdownView -->
<Style TargetType="Label" x:Key="paragraph">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontSize" Value="15" />
<Setter Property="TextColor" Value="{StaticResource HDBlack}" />
<Setter Property="FontFamily" Value="serif" />
</Style>
<Style TargetType="Label" x:Key="heading1">
<Setter Property="FontSize" Value="26" />
<Setter Property="FontSize" Value="30" />
<Setter Property="TextColor" Value="{StaticResource HDRed}" />
<Setter Property="FontFamily" Value="{DynamicResource LinuxLibertineCapitalsBold}" />
<Setter Property="FontAttributes" Value="Bold" />
</Style>
<Style TargetType="Label" x:Key="heading2">
<Setter Property="FontSize" Value="22" />
<Setter Property="FontSize" Value="25" />
<Setter Property="TextColor" Value="{StaticResource HDBlack}" />
<Setter Property="FontFamily" Value="{DynamicResource LinuxLibertineCapitalsBold}" />
<Setter Property="FontAttributes" Value="Bold" />
@ -143,14 +143,14 @@
</Style>
<Style TargetType="Label" x:Key="heading6">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontSize" Value="15" />
<Setter Property="TextColor" Value="{StaticResource HDBlack}" />
<Setter Property="FontFamily" Value="{DynamicResource LinuxLibertineCapitalsBold}" />
<Setter Property="FontAttributes" Value="Bold" />
</Style>
<Style TargetType="Label" x:Key="link">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontSize" Value="15" />
<Setter Property="TextColor" Value="{StaticResource HDBlue}" />
<Setter Property="FontFamily" Value="serif" />
</Style>
@ -165,7 +165,7 @@
</Style>
<Style TargetType="Label" x:Key="tablecell">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="1" />
<Setter Property="TextColor" Value="{StaticResource HDBlack}" />
<Setter Property="BackgroundColor" Value="{StaticResource HDWhite}" />
@ -173,7 +173,7 @@
</Style>
<Style TargetType="Label" x:Key="tablecellalt">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="1" />
<Setter Property="TextColor" Value="{StaticResource HDBlack}" />
<Setter Property="BackgroundColor" Value="{StaticResource HDLightGrey}" />

View file

@ -39,6 +39,28 @@ namespace AideDeJeu.Tools
}
}
public class NullOrEmptyToFalseConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return false;
if (value is string)
{
var svalue = value as string;
if(svalue.Length == 0)
{
return false;
}
}
return true;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
public class IntToValueConverter<T> : IValueConverter
{
public T NullOrZeroValue { get; set; }

View file

@ -55,6 +55,23 @@ namespace AideDeJeu.ViewModels
}
private ICommand _GotoItemCommand = null;
public ICommand GotoItemCommand
{
get
{
return _GotoItemCommand ?? (_GotoItemCommand = new Command<Item>(async(item) => await ExecuteGotoItemCommand(item)));
}
}
private async Task ExecuteGotoItemCommand(Item item)
{
var litem = item as LinkItem;
var Main = DependencyService.Get<MainViewModel>();
await Main.Navigator.NavigateToLinkAsync(litem.Link);
}
private ICommand _RemoveItemCommand = null;
public ICommand RemoveItemCommand
{

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:tools="clr-namespace:AideDeJeu.Tools"
x:Class="AideDeJeu.Views.BookmarksEditPage"
x:Name="This"
Title="Favoris">
<ContentPage.Resources>
<ResourceDictionary>
<tools:IntToBooleanConverter x:Key="IntToBooleanConverter" NonZeroValue="False" NullOrZeroValue="True" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<Grid BackgroundColor="{StaticResource HDWhite}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Entry Grid.Column="0" Grid.Row="0" Style="{StaticResource heading1}" HorizontalOptions="FillAndExpand" />
<ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" SelectionMode="None" ItemsSource="{Binding BookmarkCollection}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Text="{Binding Name}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="16" />
<Label Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" Text="{Binding Link}" LineBreakMode="WordWrap" Style="{DynamicResource heading3}" FontSize="12" />
<Button Grid.Column="0" Grid.Row="2" Text="Supprimer" Command="{Binding BindingContext.RemoveItemCommand, Source={x:Reference This}}" CommandParameter="{Binding}" />
<Button Grid.Column="1" Grid.Row="2" Text="Monter" Command="{Binding BindingContext.MoveUpItemCommand, Source={x:Reference This}}" CommandParameter="{Binding}" />
<Button Grid.Column="2" Grid.Row="2" Text="Descendre" Command="{Binding BindingContext.MoveDownItemCommand, Source={x:Reference This}}" CommandParameter="{Binding}" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ActivityIndicator
Grid.Column="0" Grid.Row="0"
VerticalOptions="StartAndExpand"
HorizontalOptions="End"
Color="{StaticResource HDRed}"
IsRunning="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"
IsVisible="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}">
<ActivityIndicator.WidthRequest>
<OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="400" Android="50" />
</ActivityIndicator.WidthRequest>
<ActivityIndicator.HeightRequest>
<OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="10" Android="50" />
</ActivityIndicator.HeightRequest>
</ActivityIndicator>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -1,33 +0,0 @@
using AideDeJeu.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class BookmarksEditPage : ContentPage
{
public BookmarksEditPage ()
{
InitializeComponent ();
BindingContext = DependencyService.Get<BookmarksViewModel>();
}
private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
await Navigation.PopAsync();
}
private async void ItemsListView_ItemTapped(object sender, ItemTappedEventArgs e)
{
}
}
}

View file

@ -13,7 +13,6 @@
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem Name="Settings" Text="Paramètres" Order="Primary" Icon="settings_knobs.png" Clicked="TapGestureRecognizer_Tapped" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<Grid BackgroundColor="{StaticResource HDWhite}">
@ -30,7 +29,7 @@
<Label Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="15,0,15,0" Style="{StaticResource heading3}" Text="Cette liste est vide, ajoutez des éléments à partir de la bibliothèque !" IsVisible="{Binding BookmarkCollection.Count, Converter={StaticResource IntToBooleanConverter}}" />
<ListView Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" x:Name="ItemsListView" SelectionMode="None" ItemsSource="{Binding BookmarkCollection}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
<ListView Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" x:Name="ItemsListView" SelectionMode="None" ItemsSource="{Binding BookmarkCollection}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
@ -42,7 +41,11 @@
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=1}" />
<Label Grid.Column="0" Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=2}" HorizontalOptions="Fill">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding BindingContext.GotoItemCommand, Source={x:Reference This}}" CommandParameter="{Binding}" />
</Label.GestureRecognizers>
</Label>
<Image Grid.Column="1" Source="trash_can.png" WidthRequest="32" HeightRequest="32">
<Image.GestureRecognizers>

View file

@ -20,17 +20,5 @@ namespace AideDeJeu.Views
BindingContext = DependencyService.Get<BookmarksViewModel>();
}
private async void ItemsListView_ItemTapped(object sender, ItemTappedEventArgs e)
{
var item = e.Item as LinkItem;
var Main = DependencyService.Get<MainViewModel>();
await Main.Navigator.NavigateToLinkAsync(item.Link);
}
private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
await Navigation.PushAsync(new BookmarksEditPage());
}
}
}

View file

@ -58,7 +58,7 @@
<DataTemplate>
<ViewCell>
<StackLayout Padding="10" Orientation="Vertical">
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=1}" />
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=2}" />
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" TextColor="{StaticResource HDLightGrey}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=4}" />
</StackLayout>
</ViewCell>

View file

@ -12,6 +12,7 @@
<ResourceDictionary>
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
<tools:NullOrEmptyToFalseConverter x:Key="NullOrEmptyToFalseConverter" />
<tools:HeaderLevelToStyleConverter x:Key="HeaderLevelToStyleConverter" />
</ResourceDictionary>
</ContentPage.Resources>
@ -31,8 +32,8 @@
<DataTemplate>
<ViewCell>
<StackLayout Padding="10" Orientation="Vertical">
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=1}" />
<Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" TextColor="{StaticResource HDLightGrey}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=4}" />
<Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="{StaticResource HDBlue}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=2}" />
<Label IsVisible="{Binding AltNameText, Converter={StaticResource NullOrEmptyToFalseConverter}}" Text="{Binding AltNameText}" LineBreakMode="WordWrap" TextColor="{StaticResource HDLightGrey}" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}, ConverterParameter=4}" />
</StackLayout>
</ViewCell>
</DataTemplate>