Skip to content

Commit f0fa595

Browse files
authored
Feature: Added support for hiding the toolbar (#15627)
1 parent 5634f4c commit f0fa595

File tree

8 files changed

+51
-1
lines changed

8 files changed

+51
-1
lines changed

src/Files.App/Data/Contracts/IAppearanceSettingsService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,10 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
9696
/// Gets or sets a value for the app background image Horizontal Alignment.
9797
/// </summary>
9898
HorizontalAlignment AppThemeBackgroundImageHorizontalAlignment { get; set; }
99+
100+
/// <summary>
101+
/// Gets or sets a value whether the toolbar should be displayed.
102+
/// </summary>
103+
bool ShowToolbar { get; set; }
99104
}
100105
}

src/Files.App/Services/Settings/AppearanceSettingsService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ public HorizontalAlignment AppThemeBackgroundImageHorizontalAlignment
131131
set => Set(value);
132132
}
133133

134+
/// <inheritdoc/>
135+
public bool ShowToolbar
136+
{
137+
get => Get(true);
138+
set => Set(value);
139+
}
140+
134141
protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
135142
{
136143
base.RaiseOnSettingChangedEvent(sender, e);

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,4 +3859,8 @@
38593859
<data name="StatusWithColon" xml:space="preserve">
38603860
<value>Status:</value>
38613861
</data>
3862+
<data name="ShowToolbar" xml:space="preserve">
3863+
<value>Show Toolbar</value>
3864+
<comment>Setting that controls if the Toolbar is shown in the main view</comment>
3865+
</data>
38623866
</root>

src/Files.App/Styles/PathIcons.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121

122122
<x:String x:Key="App.Theme.PathIcon.ActionDelete">M9.29895 5.75C8.7216 4.75 7.27823 4.75 6.70088 5.75L6.24929 6.53218C6.10532 6.78152 6.20117 7.10063 6.45869 7.22939C6.69528 7.34768 6.98306 7.26125 7.11531 7.03218L7.5669 6.25C7.75935 5.91667 8.24048 5.91667 8.43293 6.25L8.88452 7.03218C9.01677 7.26125 9.30455 7.34768 9.54113 7.22939C9.79866 7.10063 9.8945 6.78152 9.75054 6.53218L9.29895 5.75ZM10.165 9.25L10.0574 9.06375C9.91348 8.8144 10.0093 8.4953 10.2668 8.36653C10.5034 8.24824 10.7912 8.33468 10.9235 8.56375L11.031 8.75C11.6084 9.75 10.8867 11 9.73196 11H8.99991C8.72377 11 8.49991 10.7761 8.49991 10.5C8.49991 10.2239 8.72377 10 8.99991 10H9.73196C10.1169 10 10.3574 9.58333 10.165 9.25ZM6.99991 10C7.27606 10 7.49991 10.2239 7.49991 10.5C7.49991 10.7761 7.27606 11 6.99991 11H6.26786C5.11316 11 4.39147 9.75 4.96882 8.75L5.07636 8.56375C5.20861 8.33468 5.4964 8.24824 5.73298 8.36653C5.9905 8.4953 6.08635 8.8144 5.94238 9.06375L5.83485 9.25C5.6424 9.58333 5.88296 10 6.26786 10H6.99991ZM13.9142 0.585786C14.2893 0.960859 14.5 1.46957 14.5 2V2.56L13.17 14.23C13.1133 14.7196 12.8778 15.1711 12.5087 15.4978C12.1396 15.8244 11.6629 16.0033 11.17 16H4.85C4.35711 16.0033 3.88037 15.8244 3.51127 15.4978C3.14216 15.1711 2.90667 14.7196 2.85 14.23L1.5 2.56V2C1.5 1.46957 1.71071 0.960859 2.08579 0.585786C2.46086 0.210714 2.96957 0 3.5 0H12.5C13.0304 0 13.5391 0.210714 13.9142 0.585786ZM12.5 1H3.5C3.23478 1 2.98043 1.10536 2.79289 1.29289C2.60536 1.48043 2.5 1.73478 2.5 2H13.5C13.5 1.73478 13.3946 1.48043 13.2071 1.29289C13.0196 1.10536 12.7652 1 12.5 1ZM11.8309 14.747C12.0156 14.5827 12.1328 14.3557 12.16 14.11L13.44 3H2.56L3.84 14.11C3.86719 14.3557 3.98443 14.5827 4.16911 14.747C4.35378 14.9114 4.59279 15.0015 4.84 15H11.16C11.4072 15.0015 11.6462 14.9114 11.8309 14.747Z</x:String>
123123

124+
<x:String x:Key="App.Theme.PathIcon.WebAsset">M 4.9219 18.75 C 4.4336 18.75 3.9665 18.6507 3.5205 18.4521 C 3.0745 18.2536 2.6839 17.9867 2.3486 17.6514 C 2.0133 17.3161 1.7464 16.9255 1.5479 16.4795 C 1.3493 16.0335 1.25 15.5664 1.25 15.0781 L 1.25 4.9219 C 1.25 4.4336 1.3493 3.9665 1.5479 3.5205 C 1.7464 3.0745 2.0133 2.6839 2.3486 2.3486 C 2.6839 2.0133 3.0745 1.7464 3.5205 1.5479 C 3.9665 1.3493 4.4336 1.25 4.9219 1.25 L 15.0781 1.25 C 15.5664 1.25 16.0335 1.3493 16.4795 1.5479 C 16.9255 1.7464 17.3161 2.0133 17.6514 2.3486 C 17.9867 2.6839 18.2536 3.0745 18.4521 3.5205 C 18.6507 3.9665 18.75 4.4336 18.75 4.9219 L 18.75 15.0781 C 18.75 15.5664 18.6507 16.0335 18.4521 16.4795 C 18.2536 16.9255 17.9867 17.3161 17.6514 17.6514 C 17.3161 17.9867 16.9255 18.2536 16.4795 18.4521 C 16.0335 18.6507 15.5664 18.75 15.0781 18.75 Z M 15.0488 17.5 C 15.3743 17.5 15.6852 17.4333 15.9814 17.2998 C 16.2777 17.1663 16.5381 16.9873 16.7627 16.7627 C 16.9873 16.5381 17.1663 16.2777 17.2998 15.9814 C 17.4333 15.6852 17.5 15.3743 17.5 15.0488 L 17.5 4.9512 C 17.5 4.6257 17.4333 4.3148 17.2998 4.0186 C 17.1663 3.7223 16.9873 3.4619 16.7627 3.2373 C 16.5381 3.0127 16.2777 2.8337 15.9814 2.7002 C 15.6852 2.5667 15.3743 2.5 15.0488 2.5 L 4.9512 2.5 C 4.6257 2.5 4.3148 2.5667 4.0186 2.7002 C 3.7223 2.8337 3.4619 3.0127 3.2373 3.2373 C 3.0127 3.4619 2.8337 3.7223 2.7002 4.0186 C 2.5667 4.3148 2.5 4.6257 2.5 4.9512 L 2.5 15.0488 C 2.5 15.3743 2.5667 15.6852 2.7002 15.9814 C 2.8337 16.2777 3.0127 16.5381 3.2373 16.7627 C 3.4619 16.9873 3.7223 17.1663 4.0186 17.2998 C 4.3148 17.4333 4.6257 17.5 4.9512 17.5 Z M 5.625 6.25 C 5.4557 6.25 5.3092 6.1882 5.1855 6.0645 C 5.0618 5.9408 5 5.7943 5 5.625 C 5 5.4557 5.0618 5.3092 5.1855 5.1855 C 5.3092 5.0618 5.4557 5 5.625 5 L 14.375 5 C 14.5443 5 14.6908 5.0618 14.8145 5.1855 C 14.9382 5.3092 15 5.4557 15 5.625 C 15 5.7943 14.9382 5.9408 14.8145 6.0645 C 14.6908 6.1882 14.5443 6.25 14.375 6.25 Z Z Z</x:String>
125+
124126
<Style x:Key="ColorIconStatusCenter" TargetType="local:OpacityIcon">
125127
<Setter Property="Template">
126128
<Setter.Value>

src/Files.App/ViewModels/MainPageViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public VerticalAlignment AppThemeBackgroundImageVerticalAlignment
7878
public HorizontalAlignment AppThemeBackgroundImageHorizontalAlignment
7979
=> AppearanceSettingsService.AppThemeBackgroundImageHorizontalAlignment;
8080

81+
public bool ShowToolbar
82+
=> AppearanceSettingsService.ShowToolbar;
83+
8184

8285
// Commands
8386

@@ -108,6 +111,9 @@ public MainPageViewModel()
108111
case nameof(AppearanceSettingsService.AppThemeBackgroundImageHorizontalAlignment):
109112
OnPropertyChanged(nameof(AppThemeBackgroundImageHorizontalAlignment));
110113
break;
114+
case nameof(AppearanceSettingsService.ShowToolbar):
115+
OnPropertyChanged(nameof(ShowToolbar));
116+
break;
111117
}
112118
};
113119
}

src/Files.App/ViewModels/Settings/AppearanceViewModel.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,19 @@ public string SelectedImageHorizontalAlignmentType
276276
}
277277
}
278278
}
279+
280+
public bool ShowToolbar
281+
{
282+
get => UserSettingsService.AppearanceSettingsService.ShowToolbar;
283+
set
284+
{
285+
if (value != UserSettingsService.AppearanceSettingsService.ShowToolbar)
286+
{
287+
UserSettingsService.AppearanceSettingsService.ShowToolbar = value;
288+
289+
OnPropertyChanged();
290+
}
291+
}
292+
}
279293
}
280294
}

src/Files.App/Views/MainPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@
221221
Loaded="NavToolbar_Loaded"
222222
ShowPreviewPaneButton="{x:Bind ViewModel.ShouldPreviewPaneBeDisplayed, Mode=OneWay}"
223223
ShowViewControlButton="{x:Bind ViewModel.ShouldViewControlBeDisplayed, Mode=OneWay}"
224-
TabIndex="2" />
224+
TabIndex="2"
225+
Visibility="{x:Bind ViewModel.ShowToolbar, Mode=OneWay}" />
225226

226227
<!-- Page Content -->
227228
<ContentPresenter

src/Files.App/Views/Settings/AppearancePage.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@
242242
</StackPanel>
243243
</local:SettingsBlockControl.ExpandableContent>
244244
</local:SettingsBlockControl>
245+
246+
<!-- Show toolbar -->
247+
<local:SettingsBlockControl Title="{helpers:ResourceString Name=ShowToolbar}" HorizontalAlignment="Stretch">
248+
<local:SettingsBlockControl.Icon>
249+
<PathIcon Data="{StaticResource App.Theme.PathIcon.WebAsset}" />
250+
</local:SettingsBlockControl.Icon>
251+
<ToggleSwitch
252+
AutomationProperties.Name="{helpers:ResourceString Name=ShowToolbar}"
253+
IsOn="{x:Bind ViewModel.ShowToolbar, Mode=TwoWay}"
254+
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
255+
</local:SettingsBlockControl>
245256
</StackPanel>
246257
</Grid>
247258
</Page>

0 commit comments

Comments
 (0)