Skip to content

Commit 7174c41

Browse files
committed
CQ
1 parent a60faa0 commit 7174c41

File tree

3 files changed

+42
-71
lines changed

3 files changed

+42
-71
lines changed

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

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -160,71 +160,5 @@ public static int GetColumnsViewRowHeight(ColumnsViewSizeKind columnsViewSizeKin
160160
return 32;
161161
}
162162
}
163-
164-
/// <summary>
165-
/// Gets the desired width for items in the Cards View
166-
/// </summary>
167-
/// <param name="cardsViewSizeKind"></param>
168-
/// <returns></returns>
169-
public static int GetCardsViewItemWidth(CardsViewSizeKind cardsViewSizeKind)
170-
{
171-
switch (cardsViewSizeKind)
172-
{
173-
case CardsViewSizeKind.Small:
174-
return 300;
175-
case CardsViewSizeKind.Medium:
176-
return 200;
177-
case CardsViewSizeKind.Large:
178-
return 240;
179-
case CardsViewSizeKind.ExtraLarge:
180-
return 260;
181-
default:
182-
return 300;
183-
}
184-
}
185-
186-
/// <summary>
187-
/// Gets the desired height for the Icon Box in the Cards View
188-
/// </summary>
189-
/// <param name="columnsViewSizeKind"></param>
190-
/// <returns></returns>
191-
public static int GetCardsViewIconBoxHeight(CardsViewSizeKind cardsViewSizeKind)
192-
{
193-
switch (cardsViewSizeKind)
194-
{
195-
case CardsViewSizeKind.Small:
196-
return 128;
197-
case CardsViewSizeKind.Medium:
198-
return 111;
199-
case CardsViewSizeKind.Large:
200-
return 128;
201-
case CardsViewSizeKind.ExtraLarge:
202-
return 160;
203-
default:
204-
return 128;
205-
}
206-
}
207-
208-
/// <summary>
209-
/// Gets the desired width for the Icon Box in the Cards View
210-
/// </summary>
211-
/// <param name="columnsViewSizeKind"></param>
212-
/// <returns></returns>
213-
public static int GetCardsViewIconBoxWidth(CardsViewSizeKind cardsViewSizeKind)
214-
{
215-
switch (cardsViewSizeKind)
216-
{
217-
case CardsViewSizeKind.Small:
218-
return 128;
219-
case CardsViewSizeKind.Medium:
220-
return 200;
221-
case CardsViewSizeKind.Large:
222-
return 240;
223-
case CardsViewSizeKind.ExtraLarge:
224-
return 260;
225-
default:
226-
return 128;
227-
}
228-
}
229163
}
230164
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@
438438
<UserControl>
439439
<Grid
440440
Width="{Binding ElementName=PageRoot, Path=CardsViewItemWidth, Mode=OneWay}"
441-
MaxHeight="200"
441+
Height="{Binding ElementName=PageRoot, Path=CardsViewItemHeight, Mode=OneWay}"
442442
Padding="0"
443443
HorizontalAlignment="Left"
444444
VerticalAlignment="Stretch"

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

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,59 @@ public int ItemWidthGridView
6969
/// </summary>
7070
public int CardsViewItemWidth
7171
{
72-
get => LayoutSizeKindHelper.GetCardsViewItemWidth(UserSettingsService.LayoutSettingsService.CardViewSize);
72+
get => UserSettingsService.LayoutSettingsService.CardViewSize switch
73+
{
74+
CardsViewSizeKind.Small => 300,
75+
CardsViewSizeKind.Medium => 200,
76+
CardsViewSizeKind.Large => 240,
77+
CardsViewSizeKind.ExtraLarge => 260,
78+
_ => 300
79+
};
80+
}
81+
82+
/// <summary>
83+
/// Item height in the Cards View layout
84+
/// </summary>
85+
public int CardsViewItemHeight
86+
{
87+
get => UserSettingsService.LayoutSettingsService.CardViewSize switch
88+
{
89+
CardsViewSizeKind.Small => 128,
90+
CardsViewSizeKind.Medium => 200,
91+
CardsViewSizeKind.Large => 240,
92+
CardsViewSizeKind.ExtraLarge => 260,
93+
_ => 128
94+
};
7395
}
7496

7597
/// <summary>
7698
/// Icon Box height in the Cards View layout.
7799
/// </summary>
78100
public int CardsViewIconBoxHeight
79101
{
80-
get => LayoutSizeKindHelper.GetCardsViewIconBoxHeight(UserSettingsService.LayoutSettingsService.CardViewSize);
102+
get => UserSettingsService.LayoutSettingsService.CardViewSize switch
103+
{
104+
CardsViewSizeKind.Small => 128,
105+
CardsViewSizeKind.Medium => 111,
106+
CardsViewSizeKind.Large => 128,
107+
CardsViewSizeKind.ExtraLarge => 160,
108+
_ => 128
109+
};
81110
}
82-
111+
83112
/// <summary>
84113
/// Icon Box width in the Cards View layout.
85114
/// </summary>
86115
public int CardsViewIconBoxWidth
87116
{
88-
get => LayoutSizeKindHelper.GetCardsViewIconBoxWidth(UserSettingsService.LayoutSettingsService.CardViewSize);
117+
get => UserSettingsService.LayoutSettingsService.CardViewSize switch
118+
{
119+
CardsViewSizeKind.Small => 128,
120+
CardsViewSizeKind.Medium => 200,
121+
CardsViewSizeKind.Large => 240,
122+
CardsViewSizeKind.ExtraLarge => 260,
123+
_ => 128
124+
};
89125
}
90126

91127
/// <summary>
@@ -209,6 +245,7 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
209245
if (e.PropertyName == nameof(ILayoutSettingsService.CardViewSize))
210246
{
211247
NotifyPropertyChanged(nameof(CardsViewItemWidth));
248+
NotifyPropertyChanged(nameof(CardsViewItemHeight));
212249
NotifyPropertyChanged(nameof(CardsViewIconBoxHeight));
213250
NotifyPropertyChanged(nameof(CardsViewIconBoxWidth));
214251
NotifyPropertyChanged(nameof(CardsViewIconSize));

0 commit comments

Comments
 (0)