Skip to content

Commit

Permalink
Code Quality: Fix column layout sizing (#14822)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Feb 23, 2024
1 parent 8600d3d commit 6ab55cc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
2 changes: 2 additions & 0 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="-2" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
Expand All @@ -140,6 +141,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="4,0" />
</Style>

</local:BaseGroupableLayoutPage.Resources>
Expand Down
11 changes: 3 additions & 8 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public sealed partial class ColumnLayoutPage : BaseGroupableLayoutPage
public int RowHeight
{
get => LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
set
{
if (value != LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize))
{
NotifyPropertyChanged(nameof(RowHeight));
}
}
}

// Constructor
Expand Down Expand Up @@ -178,7 +171,9 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang

if (e.PropertyName == nameof(ILayoutSettingsService.ColumnsViewSize))
{
RowHeight = LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
NotifyPropertyChanged(nameof(RowHeight));

// Update the container style to match the item size
SetItemContainerStyle();
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public double MaxWidthForRenameTextbox
public int RowHeight
{
get => LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize);
set
{
if (value != LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize))
NotifyPropertyChanged(nameof(RowHeight));
}
}


Expand Down Expand Up @@ -200,7 +195,7 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
// Get current scroll position
var previousOffset = ContentScroller?.VerticalOffset;

RowHeight = LayoutSizeKindHelper.GetDetailsViewRowHeight(UserSettingsService.LayoutSettingsService.DetailsViewSize);
NotifyPropertyChanged(nameof(RowHeight));

// Update the container style to match the item size
SetItemContainerStyle();
Expand Down
29 changes: 11 additions & 18 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage
public int RowHeightListView
{
get => LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
set
{
if (value != LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize))
NotifyPropertyChanged(nameof(RowHeightListView));
}
}

/// <summary>
Expand All @@ -51,11 +46,6 @@ public int RowHeightListView
public int ItemWidthTilesView
{
get => LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
set
{
if (value != LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize))
NotifyPropertyChanged(nameof(ItemWidthTilesView));
}
}

/// <summary>
Expand All @@ -64,11 +54,6 @@ public int ItemWidthTilesView
public int ItemWidthGridView
{
get => LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
set
{
if (value != LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize))
NotifyPropertyChanged(nameof(ItemWidthGridView));
}
}

public bool IsPointerOver
Expand Down Expand Up @@ -166,20 +151,28 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang

if (e.PropertyName == nameof(ILayoutSettingsService.ListViewSize))
{
RowHeightListView = LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
NotifyPropertyChanged(nameof(RowHeightListView));

// Update the container style to match the item size
SetItemContainerStyle();

FolderSettings_IconHeightChanged();
}
if (e.PropertyName == nameof(ILayoutSettingsService.TilesViewSize))
{
ItemWidthTilesView = LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
NotifyPropertyChanged(nameof(ItemWidthTilesView));

// Update the container style to match the item size
SetItemContainerStyle();
FolderSettings_IconHeightChanged();
}
if (e.PropertyName == nameof(ILayoutSettingsService.GridViewSize))
{
ItemWidthGridView = LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
NotifyPropertyChanged(nameof(ItemWidthGridView));

// Update the container style to match the item size
SetItemContainerStyle();

FolderSettings_IconHeightChanged();
}
}
Expand Down

0 comments on commit 6ab55cc

Please sign in to comment.