Skip to content

Commit 485fa5e

Browse files
committed
C
1 parent 0f955e1 commit 485fa5e

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
214214
// Restore correct scroll position
215215
ContentScroller?.ChangeView(null, previousOffset, null);
216216

217-
// Reload icons with correct size but only if the size changed
218-
var requestedIconSize = LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.DetailsView);
219-
if (requestedIconSize != currentIconSize)
217+
// Check if icons need to be reloaded
218+
var newIconSize = LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.DetailsView);
219+
if (newIconSize != currentIconSize)
220220
{
221-
currentIconSize = requestedIconSize;
221+
currentIconSize = newIconSize;
222222
_ = ReloadItemIconsAsync();
223223
}
224224
}

src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,30 +179,30 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
179179

180180
// Update the container style to match the item size
181181
SetItemContainerStyle();
182-
FolderSettings_IconHeightChanged();
182+
FolderSettings_IconSizeChanged();
183183
}
184184
if (e.PropertyName == nameof(ILayoutSettingsService.TilesViewSize))
185185
{
186186
NotifyPropertyChanged(nameof(ItemWidthTilesView));
187187

188188
// Update the container style to match the item size
189189
SetItemContainerStyle();
190-
FolderSettings_IconHeightChanged();
190+
FolderSettings_IconSizeChanged();
191191
}
192192
if (e.PropertyName == nameof(ILayoutSettingsService.GridViewSize))
193193
{
194194
NotifyPropertyChanged(nameof(ItemWidthGridView));
195195

196196
// Update the container style to match the item size
197197
SetItemContainerStyle();
198-
FolderSettings_IconHeightChanged();
198+
FolderSettings_IconSizeChanged();
199199
}
200200

201201
// Restore correct scroll position
202202
ContentScroller?.ChangeView(previousHorizontalOffset, previousVerticalOffset, null);
203203
}
204204

205-
private async void FolderSettings_LayoutModeChangeRequested(object? sender, LayoutModeEventArgs e)
205+
private void FolderSettings_LayoutModeChangeRequested(object? sender, LayoutModeEventArgs e)
206206
{
207207
if (FolderSettings.LayoutMode == FolderLayoutModes.ListView
208208
|| FolderSettings.LayoutMode == FolderLayoutModes.TilesView
@@ -211,14 +211,7 @@ private async void FolderSettings_LayoutModeChangeRequested(object? sender, Layo
211211
// Set ItemTemplate
212212
SetItemTemplate();
213213
SetItemContainerStyle();
214-
215-
var requestedIconSize = LayoutSizeKindHelper.GetIconSize(FolderSettings.LayoutMode);
216-
if (requestedIconSize != currentIconSize)
217-
{
218-
currentIconSize = requestedIconSize;
219-
// Don't change this await https://github.com/files-community/Files/pull/16708#discussion_r1916402106
220-
await ReloadItemIconsAsync();
221-
}
214+
FolderSettings_IconSizeChanged();
222215
}
223216
}
224217

@@ -500,16 +493,13 @@ protected override async void FileList_PreviewKeyDown(object sender, KeyRoutedEv
500493
protected override bool CanGetItemFromElement(object element)
501494
=> element is GridViewItem;
502495

503-
private async void FolderSettings_IconHeightChanged()
496+
private void FolderSettings_IconSizeChanged()
504497
{
505-
// Get new icon size
506-
var requestedIconSize = LayoutSizeKindHelper.GetIconSize(FolderSettings.LayoutMode);
507-
508-
// Prevents reloading icons when the icon size hasn't changed
509-
if (requestedIconSize != currentIconSize)
498+
// Check if icons need to be reloaded
499+
var newIconSize = LayoutSizeKindHelper.GetIconSize(FolderSettings.LayoutMode);
500+
if (newIconSize != currentIconSize)
510501
{
511-
// Update icon size before refreshing
512-
currentIconSize = requestedIconSize;
502+
currentIconSize = newIconSize;
513503
_ = ReloadItemIconsAsync();
514504
}
515505
}

0 commit comments

Comments
 (0)