Skip to content

Commit fb2e1bd

Browse files
committed
Replace sizes with constants
1 parent 3a80b07 commit fb2e1bd

File tree

12 files changed

+21
-21
lines changed

12 files changed

+21
-21
lines changed

src/Files.App/Constants.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,18 @@ public static class GridViewBrowser
132132

133133
public const int TilesView = 100;
134134
}
135+
}
135136

136-
public static class DetailsLayoutBrowser
137-
{
138-
public const int DetailsViewSize = 32;
139-
}
137+
// Default icon sizes that are available for files and folders
138+
public static class DefaultIconSizes
139+
{
140+
public const int Small = 16;
140141

141-
public static class ColumnViewBrowser
142-
{
143-
public const int ColumnViewSize = 32;
142+
public const int Large = 32;
144143

145-
public const int ColumnViewSizeSmall = 24;
146-
}
144+
public const int ExtraLarge = 48;
145+
146+
public const int Jumbo = 256;
147147
}
148148

149149
public static class Widgets

src/Files.App/Data/Items/DriveItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public async Task LoadThumbnailAsync(bool isSidebar = false)
324324
else
325325
{
326326
if (!string.IsNullOrEmpty(DeviceID) && !string.Equals(DeviceID, "network-folder"))
327-
IconData ??= await FileThumbnailHelper.LoadIconWithoutOverlayAsync(DeviceID, 16u, false, true);
327+
IconData ??= await FileThumbnailHelper.LoadIconWithoutOverlayAsync(DeviceID, Constants.DefaultIconSizes.Large, false, true);
328328

329329
if (Root is not null)
330330
{

src/Files.App/Data/Models/ItemViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ await SafetyExtensions.IgnoreExceptions(() =>
12491249
ImageSource? groupImage = null;
12501250
if (item.PrimaryItemAttribute != StorageItemTypes.Folder || item.IsArchive)
12511251
{
1252-
var headerIconInfo = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(item.ItemPath, 48u, false, true);
1252+
var headerIconInfo = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(item.ItemPath, Constants.DefaultIconSizes.ExtraLarge, false, true);
12531253

12541254
if (headerIconInfo is not null && !item.IsShortcut)
12551255
groupImage = await dispatcherQueue.EnqueueOrInvokeAsync(() => headerIconInfo.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Low);

src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ public uint GetIconSize()
308308
return LayoutMode switch
309309
{
310310
FolderLayoutModes.DetailsView
311-
=> Constants.Browser.DetailsLayoutBrowser.DetailsViewSize,
311+
=> Constants.DefaultIconSizes.Large,
312312
FolderLayoutModes.ColumnView
313-
=> Constants.Browser.ColumnViewBrowser.ColumnViewSize,
313+
=> Constants.DefaultIconSizes.Large,
314314
FolderLayoutModes.TilesView
315315
=> Constants.Browser.GridViewBrowser.TilesView,
316316
_ when GridViewSize <= Constants.Browser.GridViewBrowser.GridViewSizeSmall

src/Files.App/Utils/Cloud/CloudDrivesManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static async Task UpdateDrivesAsync()
6363
ShowProperties = true,
6464
};
6565

66-
var iconData = provider.IconData ?? await FileThumbnailHelper.LoadIconWithoutOverlayAsync(provider.SyncFolder, 24u, false, true);
66+
var iconData = provider.IconData ?? await FileThumbnailHelper.LoadIconWithoutOverlayAsync(provider.SyncFolder, Constants.DefaultIconSizes.Large, false, true);
6767
if (iconData is not null)
6868
{
6969
cloudProviderItem.IconData = iconData;

src/Files.App/Utils/Library/LibraryLocationItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public async Task<bool> CheckDefaultSaveFolderAccess()
4646

4747
public async Task LoadLibraryIconAsync()
4848
{
49-
IconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Path, 24u, false, true);
49+
IconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Path, Constants.DefaultIconSizes.Large, false, true);
5050

5151
if (IconData is not null)
5252
Icon = await IconData.ToBitmapAsync();

src/Files.App/Utils/RecentItem/RecentItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public RecentItem(ShellFileItem fileItem) : base()
7676

7777
public async Task LoadRecentItemIconAsync()
7878
{
79-
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(RecentPath, 96u, false, false);
79+
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(RecentPath, Constants.DefaultIconSizes.Large, false, false);
8080
if (iconData is not null)
8181
{
8282
EmptyImgVis = false;

src/Files.App/ViewModels/UserControls/Previews/BasePreviewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ await Task.Run(async () =>
8585
public async virtual Task<List<FileProperty>> LoadPreviewAndDetailsAsync()
8686
{
8787
// Requesting sizes larger than 220 may result in a small thumbnail
88-
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, 220, false, false);
88+
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, Constants.DefaultIconSizes.Jumbo, false, false);
8989
if (iconData is not null)
9090
await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () => FileImage = await iconData.ToBitmapAsync());
9191
else

src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private async Task LoadPreviewAndDetailsAsync()
3131
var items = await Folder.GetItemsAsync();
3232

3333
// Requesting sizes larger than 220 may result in a thumbnail with a small folder
34-
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, 220, true, false);
34+
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, Constants.DefaultIconSizes.Jumbo, true, false);
3535
if (iconData is not null)
3636
Thumbnail = await iconData.ToBitmapAsync();
3737

src/Files.App/ViewModels/UserControls/Previews/ShortcutPreviewViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override async Task LoadAsync()
3636

3737
private async Task LoadItemThumbnailAsync()
3838
{
39-
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, 256, false, false);
39+
var iconData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Item.ItemPath, Constants.DefaultIconSizes.Jumbo, false, false);
4040
if (iconData is not null)
4141
{
4242
FileImage = await iconData.ToBitmapAsync();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public sealed partial class ColumnLayoutPage : BaseGroupableLayoutPage
3939

4040
// Properties
4141

42-
protected override uint IconSize => Browser.ColumnViewBrowser.ColumnViewSizeSmall;
42+
protected override uint IconSize => Browser.DefaultIconSizes.Large;
4343
protected override ListViewBase ListViewBase => FileList;
4444
protected override SemanticZoom RootZoom => RootGridZoom;
4545

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed partial class ColumnsLayoutPage : BaseLayoutPage
2020
{
2121
// Properties
2222

23-
protected override uint IconSize => Browser.ColumnViewBrowser.ColumnViewSizeSmall;
23+
protected override uint IconSize => Browser.DefaultIconSizes.Large;
2424
protected override ItemsControl ItemsControl => ColumnHost;
2525

2626
public string? OwnerPath { get; private set; }

0 commit comments

Comments
 (0)