-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code Quality: Replaced icon height & size constants with enums (#14809)
Co-authored-by: Yair <[email protected]>
- Loading branch information
Showing
18 changed files
with
348 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Helpers | ||
{ | ||
public static class LayoutSizeKindHelper | ||
{ | ||
private static ILayoutSettingsService LayoutSettingsService { get; } = Ioc.Default.GetRequiredService<ILayoutSettingsService>(); | ||
|
||
/// <summary> | ||
/// Gets the desired height for items in the Details View | ||
/// </summary> | ||
/// <param name="detailsViewSizeKind"></param> | ||
/// <returns></returns> | ||
public static int GetDetailsViewRowHeight(DetailsViewSizeKind detailsViewSizeKind) | ||
{ | ||
switch (detailsViewSizeKind) | ||
{ | ||
case DetailsViewSizeKind.Compact: | ||
return 28; | ||
case DetailsViewSizeKind.Small: | ||
return 36; | ||
case DetailsViewSizeKind.Medium: | ||
return 40; | ||
case DetailsViewSizeKind.Large: | ||
return 44; | ||
case DetailsViewSizeKind.ExtraLarge: | ||
return 48; | ||
default: | ||
return 36; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the desired width for items in the Grid View | ||
/// </summary> | ||
/// <param name="gridViewSizeKind"></param> | ||
/// <returns></returns> | ||
public static int GetGridViewItemWidth(GridViewSizeKind gridViewSizeKind) | ||
{ | ||
switch (gridViewSizeKind) | ||
{ | ||
case GridViewSizeKind.Compact: | ||
return 80; | ||
case GridViewSizeKind.Small: | ||
return 100; | ||
case GridViewSizeKind.Medium: | ||
return 120; | ||
case GridViewSizeKind.Large: | ||
return 140; | ||
case GridViewSizeKind.ExtraLarge: | ||
return 160; | ||
case GridViewSizeKind.Five: | ||
return 180; | ||
case GridViewSizeKind.Six: | ||
return 200; | ||
case GridViewSizeKind.Seven: | ||
return 220; | ||
case GridViewSizeKind.Eight: | ||
return 240; | ||
case GridViewSizeKind.Nine: | ||
return 260; | ||
case GridViewSizeKind.Ten: | ||
return 280; | ||
case GridViewSizeKind.Eleven: | ||
return 300; | ||
default: | ||
return 100; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the desired height for items in the List View | ||
/// </summary> | ||
/// <param name="listViewSizeKind"></param> | ||
/// <returns></returns> | ||
public static int GetListViewRowHeight(ListViewSizeKind listViewSizeKind) | ||
{ | ||
switch (listViewSizeKind) | ||
{ | ||
case ListViewSizeKind.Compact: | ||
return 24; | ||
case ListViewSizeKind.Small: | ||
return 32; | ||
case ListViewSizeKind.Medium: | ||
return 36; | ||
case ListViewSizeKind.Large: | ||
return 40; | ||
case ListViewSizeKind.ExtraLarge: | ||
return 44; | ||
default: | ||
return 32; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the desired height for items in the Columns View | ||
/// </summary> | ||
/// <param name="columnsViewSizeKind"></param> | ||
/// <returns></returns> | ||
public static int GetColumnsViewRowHeight(ColumnsViewSizeKind columnsViewSizeKind) | ||
{ | ||
switch (columnsViewSizeKind) | ||
{ | ||
case ColumnsViewSizeKind.Compact: | ||
return 28; | ||
case ColumnsViewSizeKind.Small: | ||
return 36; | ||
case ColumnsViewSizeKind.Medium: | ||
return 40; | ||
case ColumnsViewSizeKind.Large: | ||
return 44; | ||
case ColumnsViewSizeKind.ExtraLarge: | ||
return 48; | ||
default: | ||
return 36; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the desired width for items in the Tiles View | ||
/// </summary> | ||
/// <param name="tilesViewSizeKind"></param> | ||
/// <returns></returns> | ||
public static int GetTilesViewItemWidth(TilesViewSizeKind tilesViewSizeKind) | ||
{ | ||
return 260; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.