card refine

This commit is contained in:
DismissedLight
2023-08-08 23:50:53 +08:00
parent f8173208f4
commit 9387b955ee
7 changed files with 99 additions and 70 deletions

View File

@@ -90,7 +90,7 @@ internal sealed class DependencyPropertyGenerator : IIncrementalGenerator
public static {{propertyType}} Get{{propertyName}}({{objType}} obj)
{
return obj?.GetValue({{propertyName}}Property) as Type;
return ({{propertyType}})obj?.GetValue({{propertyName}}Property);
}
public static void Set{{propertyName}}({{objType}} obj, {{propertyType}} value)

View File

@@ -50,6 +50,9 @@
<x:Double x:Key="HomeAdaptiveCardHeight">180</x:Double>
<!-- ProgressBar -->
<x:Double x:Key="LargeBackgroundProgressBarOpacity">0.2</x:Double>
<!-- Brushes -->
<SolidColorBrush x:Key="AvatarPropertyAddValueBrush" Color="{ThemeResource AvatarPropertyAddValueColor}"/>
<!-- Settings -->
@@ -65,6 +68,7 @@
<Setter Property="Margin" Value="1,29,0,5"/>
</Style.Setters>
</Style>
<!-- Uris -->
<x:String x:Key="DocumentLink_MhyAccountSwitch">https://hut.ao/features/mhy-account-switch.html</x:String>
<x:String x:Key="DocumentLink_BugReport">https://hut.ao/statements/bug-report.html</x:String>
@@ -73,7 +77,14 @@
<x:String x:Key="HolographicHat_GetToken_Release">https://github.com/HolographicHat/GetToken/releases/latest</x:String>
<x:String x:Key="Sponsor_Afadian">https://afdian.net/a/DismissedLight</x:String>
<!-- Images -->
<x:String x:Key="UI_ItemIcon_None">https://static.snapgenshin.com/Bg/UI_ItemIcon_None.png</x:String>
<x:String x:Key="UI_MarkTower">https://static.snapgenshin.com/Bg/UI_MarkTower.png</x:String>
<x:String x:Key="UI_Icon_Intee_Explore_1">https://static.snapgenshin.com/Bg/UI_Icon_Intee_Explore_1.png</x:String>
<x:String x:Key="UI_MarkQuest_Events_Proce">https://static.snapgenshin.com/Bg/UI_MarkQuest_Events_Proce.png</x:String>
<x:String x:Key="UI_ItemIcon_204">https://static.snapgenshin.com/ItemIcon/UI_ItemIcon_204.png</x:String>
<x:String x:Key="UI_ItemIcon_210">https://static.snapgenshin.com/ItemIcon/UI_ItemIcon_210.png</x:String>
<x:String x:Key="UI_ItemIcon_220021">https://static.snapgenshin.com/ItemIcon/UI_ItemIcon_220021.png</x:String>
<x:String x:Key="UI_ImgSign_ItemIcon">https://static.snapgenshin.com/Bg/UI_ImgSign_ItemIcon.png</x:String>
<x:String x:Key="UI_AvatarIcon_Costume_Card">https://static.snapgenshin.com/AvatarCard/UI_AvatarIcon_Costume_Card.png</x:String>
<x:String x:Key="UI_EmotionIcon25">https://static.snapgenshin.com/EmotionIcon/UI_EmotionIcon25.png</x:String>
@@ -81,12 +92,7 @@
<x:String x:Key="UI_EmotionIcon250">https://static.snapgenshin.com/EmotionIcon/UI_EmotionIcon250.png</x:String>
<x:String x:Key="UI_EmotionIcon272">https://static.snapgenshin.com/EmotionIcon/UI_EmotionIcon272.png</x:String>
<x:String x:Key="UI_EmotionIcon293">https://static.snapgenshin.com/EmotionIcon/UI_EmotionIcon293.png</x:String>
<!-- 图床 Url -->
<x:String x:Key="UI_ItemIcon_204">https://smms.app/image/x9psnPrcbYoCl6U</x:String>
<x:String x:Key="UI_ItemIcon_210">https://smms.app/image/n4gwxlFGPTX2j8p</x:String>
<x:String x:Key="UI_ItemIcon_220021">https://smms.app/image/kbh1a2YVXpxWuez</x:String>
<x:String x:Key="UI_Icon_Intee_Explore_1">https://smms.app/image/zJ4UYqKiD6uQlLc</x:String>
<x:String x:Key="UI_MarkQuest_Events_Proce">https://smms.app/image/DQyTF3rv4aA8MZV</x:String>
<!-- Converters -->
<cwuc:BoolNegationConverter x:Key="BoolNegationConverter"/>
<cwuc:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
@@ -140,6 +146,12 @@
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="{StaticResource CompatCornerRadius}"/>
</Style>
<Style x:Key="BorderGridStyle" TargetType="Grid">
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="{StaticResource CompatCornerRadius}"/>
</Style>
<Style x:Key="WebView2ContentDialogStyle" TargetType="ContentDialog">
<Setter Property="Foreground" Value="{ThemeResource ContentDialogForeground}"/>
<Setter Property="Background" Value="{ThemeResource ContentDialogBackground}"/>

View File

@@ -67,6 +67,7 @@
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
<PipsPager
Height="16"
HorizontalAlignment="Center"

View File

@@ -9,6 +9,7 @@
xmlns:shci="using:Snap.Hutao.Control.Image"
xmlns:shvc="using:Snap.Hutao.View.Control"
xmlns:shvd="using:Snap.Hutao.ViewModel.DailyNote"
xmlns:shvh="using:Snap.Hutao.View.Helper"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -29,44 +30,39 @@
Visibility="{Binding IsInitialized, Converter={StaticResource BoolToVisibilityConverter}}">
<FlipView.ItemTemplate>
<DataTemplate>
<Grid
Margin="12"
ColumnSpacing="6"
RowSpacing="6">
<Grid.Resources>
<x:Double x:Key="ProgressBarOpacity">0.2</x:Double>
</Grid.Resources>
<Grid Margin="12" ColumnSpacing="6">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" RowSpacing="6">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" Text="{Binding Uid}"/>
<Border Grid.Row="1" Style="{StaticResource BorderCardStyle}">
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
Text="{Binding Uid}"/>
<Grid Grid.Row="1" Style="{StaticResource BorderGridStyle}">
<StackPanel VerticalAlignment="Center">
<Image Width="64" Source="ms-appx:///Resource/Icon/UI_ItemIcon_210.png"/>
<shci:CachedImage shvh:ControlHelper.SquareLength="64" Source="{StaticResource UI_ItemIcon_210}"/>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding DailyNote.ResinFormatted}"/>
</StackPanel>
</Border>
<InfoBadge
Grid.Row="1"
Width="8"
Height="8"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding ResinNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
<InfoBadge
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
shvh:ControlHelper.SquareLength="8"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding ResinNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
</Grid>
</Grid>
<Grid Grid.Column="1" RowSpacing="6">
@@ -74,85 +70,85 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Style="{StaticResource BorderCardStyle}">
<Grid Grid.Row="0" Style="{StaticResource BorderGridStyle}">
<StackPanel VerticalAlignment="Center">
<shci:CachedImage Width="32" Source="{StaticResource UI_ItemIcon_204}"/>
<shci:CachedImage shvh:ControlHelper.SquareLength="32" Source="{StaticResource UI_ItemIcon_204}"/>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding DailyNote.HomeCoinFormatted}"/>
</StackPanel>
</Border>
<InfoBadge
Width="8"
Height="8"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding HomeCoinNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
<Border Grid.Row="1" Style="{StaticResource BorderCardStyle}">
<InfoBadge
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
shvh:ControlHelper.SquareLength="8"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding HomeCoinNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
</Grid>
<Grid Grid.Row="1" Style="{StaticResource BorderGridStyle}">
<StackPanel VerticalAlignment="Center">
<Image Width="32" Source="ms-appx:///Resource/Icon/UI_MarkQuest_Events_Proce.png"/>
<shci:CachedImage shvh:ControlHelper.SquareLength="32" Source="{StaticResource UI_MarkQuest_Events_Proce}"/>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding DailyNote.TaskFormatted}"/>
</StackPanel>
</Border>
<InfoBadge
Grid.Row="1"
Width="8"
Height="8"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding DailyTaskNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
<InfoBadge
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
shvh:ControlHelper.SquareLength="8"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding DailyTaskNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
</Grid>
</Grid>
<Grid Grid.Column="2" RowSpacing="6">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Style="{StaticResource BorderCardStyle}">
<Grid Grid.Row="0" Style="{StaticResource BorderGridStyle}">
<StackPanel VerticalAlignment="Center">
<Image Width="32" Source="ms-appx:///Resource/Icon/UI_MarkTower.png"/>
<shci:CachedImage shvh:ControlHelper.SquareLength="32" Source="{StaticResource UI_MarkTower}"/>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding DailyNote.ResinDiscountFormatted}"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Style="{StaticResource BorderCardStyle}">
</Grid>
<Grid Grid.Row="1" Style="{StaticResource BorderGridStyle}">
<StackPanel VerticalAlignment="Center">
<Image Width="32" Source="ms-appx:///Resource/Icon/UI_ItemIcon_220021.png"/>
<shci:CachedImage shvh:ControlHelper.SquareLength="32" Source="{StaticResource UI_ItemIcon_220021}"/>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding DailyNote.Transformer.RecoveryTime.TimeLeftFormatted}"/>
</StackPanel>
</Border>
<InfoBadge
Grid.Row="1"
Width="8"
Height="8"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding TransformerNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
<InfoBadge
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
shvh:ControlHelper.SquareLength="8"
Style="{ThemeResource AttentionDotInfoBadgeStyle}"
Visibility="{Binding TransformerNotifySuppressed, Converter={StaticResource BoolToVisibilityConverter}}"/>
</Grid>
</Grid>
</Grid>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
<PipsPager
Height="16"
HorizontalAlignment="Center"

View File

@@ -28,7 +28,7 @@
Opacity="0"
Visibility="Collapsed">
<Grid>
<clw:Shimmer IsActive="{x:Bind IsLoading, Mode=OneWay}" Duration="0:0:1"/>
<clw:Shimmer IsActive="{x:Bind IsLoading, Mode=OneWay}"/>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<shci:CachedImage
Width="120"

View File

@@ -26,7 +26,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0"
Visibility="Collapsed">
<clw:Shimmer IsActive="{x:Bind IsLoading}" Duration="0:0:0.5"/>
<clw:Shimmer IsActive="{x:Bind IsLoading}" Duration="0:0:1"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="LoadingIn">

View File

@@ -0,0 +1,20 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Snap.Hutao.Control;
namespace Snap.Hutao.View.Helper;
[SuppressMessage("", "SH001")]
[DependencyProperty("SquareLength", typeof(double), 0D, nameof(OnSquareLengthChanged), IsAttached = true, AttachedType = typeof(Microsoft.UI.Xaml.Controls.Control))]
public sealed partial class ControlHelper
{
private static void OnSquareLengthChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
{
Microsoft.UI.Xaml.Controls.Control control = (Microsoft.UI.Xaml.Controls.Control)dp;
control.Width = (double)e.NewValue;
control.Height = (double)e.NewValue;
}
}