Fixed progress ring, width of empty results and message for empty results with filters

This commit is contained in:
Aleh Khantsevich
2024-05-08 19:26:47 +02:00
parent b788531e47
commit c7639309ef
2 changed files with 32 additions and 46 deletions

View File

@@ -104,10 +104,9 @@ namespace Wino.Mail.ViewModels
[NotifyPropertyChangedFor(nameof(IsEmpty))] [NotifyPropertyChangedFor(nameof(IsEmpty))]
[NotifyPropertyChangedFor(nameof(IsCriteriaFailed))] [NotifyPropertyChangedFor(nameof(IsCriteriaFailed))]
[NotifyPropertyChangedFor(nameof(IsFolderEmpty))] [NotifyPropertyChangedFor(nameof(IsFolderEmpty))]
[NotifyPropertyChangedFor(nameof(IsProgressRing))]
private bool isInitializingFolder; private bool isInitializingFolder;
private bool isLoadMoreItemsLoading;
[ObservableProperty] [ObservableProperty]
private InfoBarMessageType barSeverity; private InfoBarMessageType barSeverity;
@@ -250,22 +249,19 @@ namespace Wino.Mail.ViewModels
public bool HasMultipleItemSelections => SelectedItemCount > 1; public bool HasMultipleItemSelections => SelectedItemCount > 1;
public bool HasSelectedItems => SelectedItems.Any(); public bool HasSelectedItems => SelectedItems.Any();
public bool IsArchiveSpecialFolder => ActiveFolder?.SpecialFolderType == SpecialFolderType.Archive; public bool IsArchiveSpecialFolder => ActiveFolder?.SpecialFolderType == SpecialFolderType.Archive;
public bool IsEmpty => !IsInitializingFolder && !IsPerformingSearch && MailCollection.Count == 0;
public bool IsCriteriaFailed => IsEmpty && IsInSearchMode;
public bool IsFolderEmpty => !IsInitializingFolder && IsEmpty && !IsInSearchMode;
private bool _isPerformingSearch; /// <summary>
public bool IsPerformingSearch /// Indicates current state of the mail list. Doesn't matter it's loading or no.
{ /// </summary>
get => _isPerformingSearch; public bool IsEmpty => MailCollection.Count == 0;
set
{ /// <summary>
if (SetProperty(ref _isPerformingSearch, value)) /// Progress ring only should be visible when the folder is initializing and there are no items. We don't need to show it when there are items.
{ /// </summary>
NotifyItemFoundState(); public bool IsProgressRing => IsInitializingFolder && IsEmpty;
} private bool isFilters => IsInSearchMode || SelectedFilterOption.Type != FilterOptionType.All;
} public bool IsCriteriaFailed => !IsInitializingFolder && IsEmpty && isFilters;
} public bool IsFolderEmpty => !IsInitializingFolder && IsEmpty && !isFilters;
public bool IsInSearchMode { get; set; } public bool IsInSearchMode { get; set; }
@@ -473,24 +469,16 @@ namespace Wino.Mail.ViewModels
[RelayCommand] [RelayCommand]
public async Task PerformSearchAsync() public async Task PerformSearchAsync()
{ {
try if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
{ {
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode) IsInSearchMode = false;
{ await InitializeFolderAsync();
IsInSearchMode = false;
await InitializeFolderAsync();
}
if (!string.IsNullOrEmpty(SearchQuery))
{
IsInSearchMode = true;
IsPerformingSearch = true;
await InitializeFolderAsync();
}
} }
finally
if (!string.IsNullOrEmpty(SearchQuery))
{ {
IsPerformingSearch = false; IsInSearchMode = true;
await InitializeFolderAsync();
} }
} }

View File

@@ -403,17 +403,16 @@
<Grid x:Name="RootGrid"> <Grid x:Name="RootGrid">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ReaderColumn" Width="Auto" /> <ColumnDefinition x:Name="ReaderColumn" Width="*" MaxWidth="{x:Bind ViewModel.StatePersistanceService.MailListPaneLength, Mode=OneWay}"/>
<ColumnDefinition x:Name="RendererColumn" Width="*" /> <ColumnDefinition x:Name="RendererColumn" Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- Mail Items --> <!-- Mail Items -->
<Grid <Grid
x:Name="ReaderGrid" x:Name="ReaderGrid"
MaxWidth="{x:Bind ViewModel.StatePersistanceService.MailListPaneLength, Mode=OneWay}"
Margin="-1,0,0,0" Margin="-1,0,0,0"
Padding="4,0,0,0" Padding="4,0,0,0"
HorizontalAlignment="Left" HorizontalAlignment="Stretch"
Background="{ThemeResource ReadingPaneBackgroundColorBrush}" Background="{ThemeResource ReadingPaneBackgroundColorBrush}"
CornerRadius="{ThemeResource MailListGridCornerRadius}"> CornerRadius="{ThemeResource MailListGridCornerRadius}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -699,22 +698,21 @@
Foreground="{ThemeResource InformationBrush}" Foreground="{ThemeResource InformationBrush}"
Text="{x:Bind domain:Translator.NoMessageEmptyFolder}" Text="{x:Bind domain:Translator.NoMessageEmptyFolder}"
Visibility="{x:Bind ViewModel.IsFolderEmpty, Mode=OneWay}" /> Visibility="{x:Bind ViewModel.IsFolderEmpty, Mode=OneWay}" />
</StackPanel>
<!--Renders progress ring for search/initialization. It should be on top of everything.--> <muxc:ProgressRing
<muxc:ProgressRing Grid.Row="2"
Grid.Row="2" x:Name="LoadingProgressIndicator"
x:Name="LoadingProgressIndicator" HorizontalAlignment="Center"
HorizontalAlignment="Center" VerticalAlignment="Center"
VerticalAlignment="Center" x:Load="{x:Bind ViewModel.IsProgressRing, Mode=OneWay}"
x:Load="{x:Bind ViewModel.IsInitializingFolder, Mode=OneWay}" Canvas.ZIndex="999" />
Canvas.ZIndex="999" /> </StackPanel>
<!-- Mail Items --> <!-- Mail Items -->
<muxc:RefreshContainer <muxc:RefreshContainer
Grid.Row="2" Grid.Row="2"
RefreshRequested="PullToRefreshRequested" RefreshRequested="PullToRefreshRequested"
Visibility="{x:Bind ViewModel.IsPerformingSearch, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}"> Visibility="{x:Bind ViewModel.IsEmpty, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}">
<SemanticZoom x:Name="SemanticZoomContainer" CanChangeViews="{x:Bind ViewModel.PreferencesService.IsSemanticZoomEnabled, Mode=OneWay}"> <SemanticZoom x:Name="SemanticZoomContainer" CanChangeViews="{x:Bind ViewModel.PreferencesService.IsSemanticZoomEnabled, Mode=OneWay}">
<SemanticZoom.ZoomedInView> <SemanticZoom.ZoomedInView>
<listview:WinoListView <listview:WinoListView