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(IsCriteriaFailed))]
[NotifyPropertyChangedFor(nameof(IsFolderEmpty))]
[NotifyPropertyChangedFor(nameof(IsProgressRing))]
private bool isInitializingFolder;
private bool isLoadMoreItemsLoading;
[ObservableProperty]
private InfoBarMessageType barSeverity;
@@ -250,22 +249,19 @@ namespace Wino.Mail.ViewModels
public bool HasMultipleItemSelections => SelectedItemCount > 1;
public bool HasSelectedItems => SelectedItems.Any();
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;
public bool IsPerformingSearch
{
get => _isPerformingSearch;
set
{
if (SetProperty(ref _isPerformingSearch, value))
{
NotifyItemFoundState();
}
}
}
/// <summary>
/// Indicates current state of the mail list. Doesn't matter it's loading or no.
/// </summary>
public bool IsEmpty => MailCollection.Count == 0;
/// <summary>
/// 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>
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; }
@@ -473,24 +469,16 @@ namespace Wino.Mail.ViewModels
[RelayCommand]
public async Task PerformSearchAsync()
{
try
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
{
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
{
IsInSearchMode = false;
await InitializeFolderAsync();
}
if (!string.IsNullOrEmpty(SearchQuery))
{
IsInSearchMode = true;
IsPerformingSearch = true;
await InitializeFolderAsync();
}
IsInSearchMode = false;
await InitializeFolderAsync();
}
finally
if (!string.IsNullOrEmpty(SearchQuery))
{
IsPerformingSearch = false;
IsInSearchMode = true;
await InitializeFolderAsync();
}
}

View File

@@ -403,17 +403,16 @@
<Grid x:Name="RootGrid">
<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="*" />
</Grid.ColumnDefinitions>
<!-- Mail Items -->
<Grid
x:Name="ReaderGrid"
MaxWidth="{x:Bind ViewModel.StatePersistanceService.MailListPaneLength, Mode=OneWay}"
Margin="-1,0,0,0"
Padding="4,0,0,0"
HorizontalAlignment="Left"
HorizontalAlignment="Stretch"
Background="{ThemeResource ReadingPaneBackgroundColorBrush}"
CornerRadius="{ThemeResource MailListGridCornerRadius}">
<Grid.RowDefinitions>
@@ -699,22 +698,21 @@
Foreground="{ThemeResource InformationBrush}"
Text="{x:Bind domain:Translator.NoMessageEmptyFolder}"
Visibility="{x:Bind ViewModel.IsFolderEmpty, Mode=OneWay}" />
</StackPanel>
<!--Renders progress ring for search/initialization. It should be on top of everything.-->
<muxc:ProgressRing
Grid.Row="2"
x:Name="LoadingProgressIndicator"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Load="{x:Bind ViewModel.IsInitializingFolder, Mode=OneWay}"
Canvas.ZIndex="999" />
<muxc:ProgressRing
Grid.Row="2"
x:Name="LoadingProgressIndicator"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Load="{x:Bind ViewModel.IsProgressRing, Mode=OneWay}"
Canvas.ZIndex="999" />
</StackPanel>
<!-- Mail Items -->
<muxc:RefreshContainer
Grid.Row="2"
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.ZoomedInView>
<listview:WinoListView
@@ -781,7 +779,7 @@
</SemanticZoom>
</muxc:RefreshContainer>
<!-- Update Info Bar -->
<controls:WinoInfoBar
Title="{x:Bind ViewModel.BarTitle, Mode=OneWay}"