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