Merge pull request #181 from Tiktack/visual-adjustments
Improved attachments UI and added filter option "Has files"
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
All,
|
||||
Unread,
|
||||
Flagged,
|
||||
Mentions
|
||||
Mentions,
|
||||
Files
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"FilteringOption_All": "All",
|
||||
"FilteringOption_Flagged": "Flagged",
|
||||
"FilteringOption_Unread": "Unread",
|
||||
"FilteringOption_Files": "Has files",
|
||||
"Focused": "Focused",
|
||||
"FolderOperation_CreateSubFolder": "Create sub folder",
|
||||
"FolderOperation_Delete": "Delete",
|
||||
|
||||
5
Wino.Core.Domain/Translator.Designer.cs
generated
5
Wino.Core.Domain/Translator.Designer.cs
generated
@@ -628,6 +628,11 @@ namespace Wino.Core.Domain
|
||||
/// </summary>
|
||||
public static string FilteringOption_Unread => Resources.GetTranslatedString(@"FilteringOption_Unread");
|
||||
|
||||
/// <summary>
|
||||
/// Has files
|
||||
/// </summary>
|
||||
public static string FilteringOption_Files => Resources.GetTranslatedString(@"FilteringOption_Files");
|
||||
|
||||
/// <summary>
|
||||
/// Focused
|
||||
/// </summary>
|
||||
|
||||
@@ -156,6 +156,9 @@ namespace Wino.Core.Services
|
||||
case FilterOptionType.Flagged:
|
||||
query.Where("MailCopy.IsFlagged", true);
|
||||
break;
|
||||
case FilterOptionType.Files:
|
||||
query.Where("MailCopy.HasAttachments", true);
|
||||
break;
|
||||
}
|
||||
|
||||
if (options.IsFocusedOnly != null)
|
||||
|
||||
@@ -87,7 +87,8 @@ namespace Wino.Mail.ViewModels
|
||||
[
|
||||
new (Translator.FilteringOption_All, FilterOptionType.All),
|
||||
new (Translator.FilteringOption_Unread, FilterOptionType.Unread),
|
||||
new (Translator.FilteringOption_Flagged, FilterOptionType.Flagged)
|
||||
new (Translator.FilteringOption_Flagged, FilterOptionType.Flagged),
|
||||
new (Translator.FilteringOption_Files, FilterOptionType.Files)
|
||||
];
|
||||
|
||||
private FolderPivotViewModel _selectedFolderPivot;
|
||||
@@ -581,14 +582,12 @@ namespace Wino.Mail.ViewModels
|
||||
|
||||
private bool ShouldPreventItemAdd(IMailItem mailItem)
|
||||
{
|
||||
bool condition2 = false;
|
||||
|
||||
bool condition1 = mailItem.IsRead
|
||||
bool condition = mailItem.IsRead
|
||||
&& SelectedFilterOption.Type == FilterOptionType.Unread
|
||||
|| !mailItem.IsFlagged
|
||||
&& SelectedFilterOption.Type == FilterOptionType.Flagged;
|
||||
|
||||
return condition1 || condition2;
|
||||
return condition;
|
||||
}
|
||||
|
||||
protected override async void OnMailAdded(MailCopy addedMail)
|
||||
@@ -617,7 +616,7 @@ namespace Wino.Mail.ViewModels
|
||||
NotifyItemFoundState();
|
||||
});
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
listManipulationSemepahore.Release();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Windows.Storage;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
|
||||
@@ -11,7 +12,7 @@ namespace Wino.Extensions
|
||||
{
|
||||
if (storageFile == null) return null;
|
||||
|
||||
var bytes = await File.ReadAllBytesAsync(storageFile.Name);
|
||||
var bytes = await storageFile.ReadBytesAsync();
|
||||
|
||||
return new MailAttachmentViewModel(storageFile.Name, bytes);
|
||||
}
|
||||
|
||||
@@ -108,22 +108,16 @@ namespace Wino.Helpers
|
||||
|
||||
#region Wino Font Icon Transformation
|
||||
|
||||
public static WinoIconGlyph GetWinoIconGlyph(FilterOptionType type)
|
||||
public static WinoIconGlyph GetWinoIconGlyph(FilterOptionType type) => type switch
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case FilterOptionType.All:
|
||||
return WinoIconGlyph.SpecialFolderCategory;
|
||||
case FilterOptionType.Unread:
|
||||
return WinoIconGlyph.MarkUnread;
|
||||
case FilterOptionType.Flagged:
|
||||
return WinoIconGlyph.Flag;
|
||||
case FilterOptionType.Mentions:
|
||||
return WinoIconGlyph.NewMail;
|
||||
default:
|
||||
return WinoIconGlyph.None;
|
||||
}
|
||||
}
|
||||
FilterOptionType.All => WinoIconGlyph.SpecialFolderCategory,
|
||||
FilterOptionType.Unread => WinoIconGlyph.MarkUnread,
|
||||
FilterOptionType.Flagged => WinoIconGlyph.Flag,
|
||||
FilterOptionType.Mentions => WinoIconGlyph.NewMail,
|
||||
// TODO: Attachments icon should be added to WinoIcons.ttf.
|
||||
FilterOptionType.Files => WinoIconGlyph.None,
|
||||
_ => WinoIconGlyph.None,
|
||||
};
|
||||
|
||||
public static WinoIconGlyph GetWinoIconGlyph(MailOperation operation)
|
||||
{
|
||||
|
||||
@@ -54,11 +54,13 @@
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Attachment Template -->
|
||||
<!-- Margin -8 0 is used to remove the padding from the ListViewItem-->
|
||||
<DataTemplate x:Key="ComposerFileAttachmentTemplate" x:DataType="data:MailAttachmentViewModel">
|
||||
<Grid
|
||||
Height="75"
|
||||
Height="50"
|
||||
Background="Transparent"
|
||||
ColumnSpacing="3">
|
||||
ColumnSpacing="3"
|
||||
Margin="-8,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="36" />
|
||||
<ColumnDefinition Width="*" />
|
||||
@@ -74,7 +76,7 @@
|
||||
<!-- Name && Size -->
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
MaxWidth="250"
|
||||
MaxWidth="200"
|
||||
VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -85,7 +87,7 @@
|
||||
FontSize="13"
|
||||
Text="{x:Bind FileName}"
|
||||
MaxLines="2"
|
||||
TextTrimming="None" />
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
@@ -98,7 +100,6 @@
|
||||
|
||||
<SymbolIcon
|
||||
Grid.Column="2"
|
||||
Margin="6,0"
|
||||
VerticalAlignment="Center"
|
||||
Symbol="Cancel"
|
||||
Foreground="{StaticResource DeleteBrush}" />
|
||||
@@ -602,24 +603,24 @@
|
||||
Text="{x:Bind ViewModel.Subject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<!-- Attachments -->
|
||||
<ListView
|
||||
x:Name="AttachmentsListView"
|
||||
Grid.Row="6"
|
||||
Grid.ColumnSpan="2"
|
||||
x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.IncludedAttachments.Count), Mode=OneWay}"
|
||||
IsItemClickEnabled="True"
|
||||
ItemTemplate="{StaticResource ComposerFileAttachmentTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.IncludedAttachments, Mode=OneWay}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
ItemClick="AttachmentClicked"
|
||||
SelectionMode="None">
|
||||
<ListView x:Name="AttachmentsListView"
|
||||
Grid.Row="6"
|
||||
Grid.ColumnSpan="2"
|
||||
x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.IncludedAttachments.Count), Mode=OneWay}"
|
||||
IsItemClickEnabled="True"
|
||||
ItemTemplate="{StaticResource ComposerFileAttachmentTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.IncludedAttachments, Mode=OneWay}"
|
||||
ItemClick="AttachmentClicked"
|
||||
SelectionMode="None">
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsStackPanel Orientation="Horizontal" />
|
||||
<controls1:WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
</ListView>
|
||||
|
||||
<!--Attachments-->
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:controls2="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
|
||||
xmlns:selectors="using:Wino.Selectors"
|
||||
IsDarkEditor="{x:Bind ViewModel.IsDarkWebviewRenderer, Mode=TwoWay}"
|
||||
@@ -59,75 +60,89 @@
|
||||
ReplyAll="{StaticResource CommandBarItemReplyAllTemplate}" />
|
||||
|
||||
<!-- Attachment Template -->
|
||||
<!-- Margin -8 0 is used to remove the padding from the ListViewItem-->
|
||||
<DataTemplate x:Key="FileAttachmentTemplate" x:DataType="viewModelData:MailAttachmentViewModel">
|
||||
<Grid
|
||||
Height="75"
|
||||
Background="Transparent"
|
||||
ColumnSpacing="3">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind FileName}" />
|
||||
</ToolTipService.ToolTip>
|
||||
<Grid.ContextFlyout>
|
||||
<MenuFlyout Placement="Right">
|
||||
<MenuFlyoutItem
|
||||
Text="{x:Bind domain:Translator.Buttons_Open}"
|
||||
Command="{Binding ElementName=root, Path=ViewModel.OpenAttachmentCommand}"
|
||||
CommandParameter="{x:Bind}">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<PathIcon Data="{StaticResource OpenFilePathIcon}" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
Text="{x:Bind domain:Translator.Buttons_Save}"
|
||||
Command="{Binding ElementName=root, Path=ViewModel.SaveAttachmentCommand}"
|
||||
CommandParameter="{x:Bind}">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<PathIcon Data="{StaticResource SaveAttachmentPathIcon}" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
</MenuFlyout>
|
||||
</Grid.ContextFlyout>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="36" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Height="51">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Height="50"
|
||||
Background="Transparent"
|
||||
ColumnSpacing="3"
|
||||
Margin="-8,0,0,0">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind FileName}" />
|
||||
</ToolTipService.ToolTip>
|
||||
<Grid.ContextFlyout>
|
||||
<MenuFlyout Placement="Right">
|
||||
<MenuFlyoutItem
|
||||
Text="{x:Bind domain:Translator.Buttons_Open}"
|
||||
Command="{Binding ElementName=root, Path=ViewModel.OpenAttachmentCommand}"
|
||||
CommandParameter="{x:Bind}">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<PathIcon Data="{StaticResource OpenFilePathIcon}" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
Text="{x:Bind domain:Translator.Buttons_Save}"
|
||||
Command="{Binding ElementName=root, Path=ViewModel.SaveAttachmentCommand}"
|
||||
CommandParameter="{x:Bind}">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<PathIcon Data="{StaticResource SaveAttachmentPathIcon}" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
</MenuFlyout>
|
||||
</Grid.ContextFlyout>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="36" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Icon -->
|
||||
<ContentControl
|
||||
VerticalAlignment="Center"
|
||||
Content="{x:Bind AttachmentType}"
|
||||
ContentTemplateSelector="{StaticResource FileTypeIconSelector}" />
|
||||
<!-- Icon -->
|
||||
<ContentControl
|
||||
VerticalAlignment="Center"
|
||||
Content="{x:Bind AttachmentType}"
|
||||
ContentTemplateSelector="{StaticResource FileTypeIconSelector}" />
|
||||
|
||||
<!-- Name && Size -->
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Name && Size -->
|
||||
<Grid Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
MaxWidth="200">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
FontSize="13"
|
||||
Text="{x:Bind FileName}"
|
||||
MaxLines="2"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
FontSize="13"
|
||||
Text="{x:Bind FileName}"
|
||||
MaxLines="1"
|
||||
TextWrapping="Wrap"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Margin="0,2,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
FontSize="11"
|
||||
Foreground="Gray"
|
||||
Text="{x:Bind ReadableSize}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
FontSize="11"
|
||||
Foreground="Gray"
|
||||
Text="{x:Bind ReadableSize}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<ProgressRing
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
IsActive="{x:Bind IsBusy, Mode=OneWay}" />
|
||||
<muxc:ProgressBar
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="0,-5,0,0"
|
||||
Visibility="{x:Bind IsBusy, Mode=OneWay}"
|
||||
IsIndeterminate="{x:Bind IsBusy, Mode=OneWay}"
|
||||
ShowPaused="False"
|
||||
ShowError="False"/>
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
|
||||
</Page.Resources>
|
||||
@@ -292,20 +307,22 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<GridView
|
||||
Grid.Row="2"
|
||||
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
|
||||
x:Name="AttachmentsListView"
|
||||
x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.Attachments.Count), Mode=OneWay}"
|
||||
IsItemClickEnabled="True"
|
||||
MaxHeight="200"
|
||||
Padding="8,0,0,0"
|
||||
ItemTemplate="{StaticResource FileAttachmentTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.Attachments, Mode=OneWay}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
ItemClick="AttachmentClicked"
|
||||
SelectionMode="None" />
|
||||
<!-- Attachments -->
|
||||
<ListView x:Name="AttachmentsListView"
|
||||
Grid.Row="2"
|
||||
x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.Attachments.Count), Mode=OneWay}"
|
||||
IsItemClickEnabled="True"
|
||||
ItemTemplate="{StaticResource FileAttachmentTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.Attachments, Mode=OneWay}"
|
||||
ItemClick="AttachmentClicked"
|
||||
SelectionMode="None"
|
||||
Height="55">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<controls2:WrapPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ListView>
|
||||
|
||||
<muxc:ProgressBar
|
||||
x:Name="DownloadingProgressBar"
|
||||
|
||||
Reference in New Issue
Block a user