Skip to content

Commit 3d10a8c

Browse files
committed
Cleanup
1 parent f29990c commit 3d10a8c

File tree

2 files changed

+59
-91
lines changed

2 files changed

+59
-91
lines changed

src/Files.App/Views/Layouts/BaseLayoutPage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public abstract class BaseLayoutPage : Page, IBaseLayoutPage, INotifyPropertyCha
3939

4040
protected IFileTagsSettingsService FileTagsSettingsService { get; } = Ioc.Default.GetService<IFileTagsSettingsService>()!;
4141
protected IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetService<IUserSettingsService>()!;
42+
protected ILayoutSettingsService LayoutSettingsService { get; } = Ioc.Default.GetService<ILayoutSettingsService>()!;
4243
protected ICommandManager Commands { get; } = Ioc.Default.GetRequiredService<ICommandManager>();
4344
public InfoPaneViewModel InfoPaneViewModel { get; } = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
4445
protected readonly IWindowContext WindowContext = Ioc.Default.GetRequiredService<IWindowContext>();

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

Lines changed: 58 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -39,135 +39,102 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage
3939
protected override SemanticZoom RootZoom => RootGridZoom;
4040

4141

42+
// List View properties
43+
4244
/// <summary>
4345
/// Row height in the List View layout
4446
/// </summary>
45-
public int RowHeightListView
46-
{
47-
get => LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
48-
}
47+
public int RowHeightListView =>
48+
LayoutSizeKindHelper.GetListViewRowHeight(LayoutSettingsService.ListViewSize);
4949

5050
/// <summary>
5151
/// Icon Box size in the List View layout. The value is increased by 4px to account for icon overlays.
5252
/// </summary>
53-
public int IconBoxSizeListView
54-
{
55-
get => (int)(LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.ListView) + 4);
56-
}
53+
public int IconBoxSizeListView =>
54+
(int)(LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.ListView) + 4);
55+
56+
57+
58+
// Grid View properties
5759

5860
/// <summary>
5961
/// Item width in the Grid View layout
6062
/// </summary>
61-
public int ItemWidthGridView
62-
{
63-
get => LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
64-
}
63+
public int ItemWidthGridView =>
64+
LayoutSizeKindHelper.GetGridViewItemWidth(LayoutSettingsService.GridViewSize);
6565

6666

67+
68+
// Cards View properties
69+
6770
/// <summary>
68-
/// Details Box width in the Cards View layout
71+
/// Gets the details box width for the Cards View layout based on the card size.
6972
/// </summary>
70-
public int CardsViewDetailsBoxWidth
73+
public int CardsViewDetailsBoxWidth => LayoutSettingsService.CardsViewSize switch
7174
{
72-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
73-
{
74-
CardsViewSizeKind.Small => 196,
75-
CardsViewSizeKind.Medium => 240,
76-
CardsViewSizeKind.Large => 280,
77-
CardsViewSizeKind.ExtraLarge => 320,
78-
_ => 300
79-
};
80-
}
75+
CardsViewSizeKind.Small => 196,
76+
CardsViewSizeKind.Medium => 240,
77+
CardsViewSizeKind.Large => 280,
78+
CardsViewSizeKind.ExtraLarge => 320,
79+
_ => 300
80+
};
8181

8282
/// <summary>
83-
/// Details Box height in the Cards View layout
83+
/// Gets the details box height for the Cards View layout based on the card size.
8484
/// </summary>
85-
public int CardsViewDetailsBoxHeight
85+
public int CardsViewDetailsBoxHeight => LayoutSettingsService.CardsViewSize switch
8686
{
87-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
88-
{
89-
CardsViewSizeKind.Small => 104,
90-
CardsViewSizeKind.Medium => 144,
91-
CardsViewSizeKind.Large => 144,
92-
CardsViewSizeKind.ExtraLarge => 128,
93-
_ => 128
94-
};
95-
}
87+
CardsViewSizeKind.Small => 104,
88+
CardsViewSizeKind.Medium => 144,
89+
CardsViewSizeKind.Large => 144,
90+
CardsViewSizeKind.ExtraLarge => 128,
91+
_ => 128
92+
};
9693

9794
/// <summary>
98-
/// Icon Box height in the Cards View layout.
95+
/// Gets the icon box height for the Cards View layout based on the card size.
9996
/// </summary>
100-
public int CardsViewIconBoxHeight
97+
public int CardsViewIconBoxHeight => LayoutSettingsService.CardsViewSize switch
10198
{
102-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
103-
{
104-
CardsViewSizeKind.Small => 104,
105-
CardsViewSizeKind.Medium => 96,
106-
CardsViewSizeKind.Large => 128,
107-
CardsViewSizeKind.ExtraLarge => 160,
108-
_ => 128
109-
};
110-
}
99+
CardsViewSizeKind.Small => 104,
100+
CardsViewSizeKind.Medium => 96,
101+
CardsViewSizeKind.Large => 128,
102+
CardsViewSizeKind.ExtraLarge => 160,
103+
_ => 128
104+
};
111105

112106
/// <summary>
113-
/// Icon Box width in the Cards View layout.
107+
/// Gets the icon box width for the Cards View layout based on the card size.
114108
/// </summary>
115-
public int CardsViewIconBoxWidth
109+
public int CardsViewIconBoxWidth => LayoutSettingsService.CardsViewSize switch
116110
{
117-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
118-
{
119-
CardsViewSizeKind.Small => 104,
120-
CardsViewSizeKind.Medium => 240,
121-
CardsViewSizeKind.Large => 280,
122-
CardsViewSizeKind.ExtraLarge => 320,
123-
_ => 128
124-
};
125-
}
111+
CardsViewSizeKind.Small => 104,
112+
CardsViewSizeKind.Medium => 240,
113+
CardsViewSizeKind.Large => 280,
114+
CardsViewSizeKind.ExtraLarge => 320,
115+
_ => 128
116+
};
126117

127118
/// <summary>
128-
/// Orientation of cards in the Cards View layout.
119+
/// Gets the orientation of cards in the Cards View layout.
129120
/// </summary>
130-
public Orientation CardsViewOrientation
131-
{
132-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
133-
{
134-
CardsViewSizeKind.Small => Orientation.Horizontal,
135-
_ => Orientation.Vertical
136-
};
137-
}
138-
121+
public Orientation CardsViewOrientation => UserSettingsService.LayoutSettingsService.CardsViewSize == CardsViewSizeKind.Small
122+
? Orientation.Horizontal
123+
: Orientation.Vertical;
124+
139125
/// <summary>
140-
/// Item Name max lines in the Cards View layout.
126+
/// Gets the maximum lines for item names in the Cards View layout.
141127
/// </summary>
142-
public int CardsViewItemNameMaxLines
143-
{
144-
get => UserSettingsService.LayoutSettingsService.CardsViewSize switch
145-
{
146-
CardsViewSizeKind.ExtraLarge => 1,
147-
_ => 2
148-
};
149-
}
128+
public int CardsViewItemNameMaxLines =>
129+
LayoutSettingsService.CardsViewSize == CardsViewSizeKind.ExtraLarge ? 1 : 2;
150130

151131
/// <summary>
152-
/// Icon height in the Cards View layout.
132+
/// Gets the icon size for item names in the Cards View layout.
153133
/// </summary>
154-
public int CardsViewIconSize
155-
{
156-
get => (int)(LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.CardsView));
157-
}
134+
public int CardsViewIconSize =>
135+
(int)LayoutSizeKindHelper.GetIconSize(FolderLayoutModes.CardsView);
158136

159-
public bool IsPointerOver
160-
{
161-
get => (bool)GetValue(IsPointerOverProperty);
162-
set => SetValue(IsPointerOverProperty, value);
163-
}
164137

165-
public static readonly DependencyProperty IsPointerOverProperty =
166-
DependencyProperty.Register(
167-
nameof(IsPointerOver),
168-
typeof(bool),
169-
typeof(GridLayoutPage),
170-
new PropertyMetadata(false));
171138

172139
// Constructor
173140

0 commit comments

Comments
 (0)