Skip to content

Commit c5a2a7a

Browse files
committed
Merge remote-tracking branch 'origin/main' into issue_4028
2 parents 5396c1d + 0a2c182 commit c5a2a7a

15 files changed

+271
-172
lines changed

.github/pull_request_template.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
**Resolved / Related Issues**
1+
<!--
2+
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
3+
I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
4+
1. PR may be deleted if it is not following the template
5+
2. Only post one request per one feature request
6+
3. Try not to make duplicates. Do a quick search before posting
7+
4. Add a clarified title
8+
-->
29

10+
**Resolved / Related Issues**
311
Itemize resolved / related issues by this PR.
4-
- e.g. closes #0
5-
- e.g. related #0
12+
- Closes ...
13+
- Related ...
614

715
**Details of Changes**
8-
916
Add details of changes here.
10-
- e.g. Added ...
11-
- e.g. Fixed ...
17+
- Added ...
18+
- Fixed ...
1219

1320
**Validation**
14-
1521
How did you test these changes?
1622
- [ ] Built and ran the app
1723
- [ ] Tested the changes for accessibility
1824

1925
**Screenshots (optional)**
20-
2126
Add screenshots here.

.github/workflows/potential-duplicates.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
# Get issues with state to compare. Supported state: 'all', 'closed', 'open'.
2121
state: all
2222
# If similarity is higher than this threshold([0,1]), issue will be marked as duplicate.
23-
threshold: 0.6
23+
threshold: 0.8
2424
# Reactions to be add to comment when potential duplicates are detected.
2525
# Available reactions: "-1", "+1", "confused", "laugh", "heart", "hooray", "rocket", "eyes"
26-
reactions: 'eyes, confused'
26+
reactions: '-1, +1'
2727
# Comment to post when potential duplicates are detected.
2828
comment: >
2929
Potential duplicates: {{#issues}}

Files.Launcher/Files.Launcher.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<Version>10.0.19041.1</Version>
148148
</PackageReference>
149149
<PackageReference Include="Newtonsoft.Json">
150-
<Version>12.0.3</Version>
150+
<Version>13.0.1</Version>
151151
</PackageReference>
152152
<PackageReference Include="NLog">
153153
<Version>4.7.8</Version>
@@ -159,10 +159,10 @@
159159
<Version>4.7.0</Version>
160160
</PackageReference>
161161
<PackageReference Include="Vanara.PInvoke.Mpr">
162-
<Version>3.3.6</Version>
162+
<Version>3.3.7</Version>
163163
</PackageReference>
164164
<PackageReference Include="Vanara.Windows.Shell">
165-
<Version>3.3.6</Version>
165+
<Version>3.3.7</Version>
166166
</PackageReference>
167167
</ItemGroup>
168168
<ItemGroup>

Files.Launcher/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
3+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
44
</packages>

Files/App.xaml.cs

-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ sealed partial class App : Application
4444

4545
public static SemaphoreSlim SemaphoreSlim = new SemaphoreSlim(1, 1);
4646
public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper();
47-
4847
public static IBundlesSettings BundlesSettings = new BundlesSettingsViewModel();
49-
5048
public static SettingsViewModel AppSettings { get; private set; }
5149
public static InteractionViewModel InteractionViewModel { get; private set; }
5250
public static JumpListManager JumpList { get; } = new JumpListManager();

Files/Assets/FilesHome.png

4.41 MB
Loading

Files/Converters/NavigationViewCompactConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public object Convert(object value, Type targetType, object parameter, string la
1313

1414
public object ConvertBack(object value, Type targetType, object parameter, string language)
1515
{
16-
throw new NotImplementedException();
16+
return (value as NavigationViewPaneDisplayMode?) == NavigationViewPaneDisplayMode.LeftCompact;
1717
}
1818
}
1919
}

Files/Files.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@
285285
<Compile Include="UserControls\Widgets\Bundles.xaml.cs">
286286
<DependentUpon>Bundles.xaml</DependentUpon>
287287
</Compile>
288+
<Compile Include="ViewModels\AdaptiveSidebarViewModel.cs" />
288289
<Compile Include="ViewModels\BaseJsonSettingsViewModel.cs" />
289290
<Compile Include="ViewModels\Bundles\BundleContainerViewModel.cs" />
290291
<Compile Include="ViewModels\Bundles\BundleItemViewModel.cs" />
@@ -985,10 +986,10 @@
985986
<Version>2020.3.0</Version>
986987
</PackageReference>
987988
<PackageReference Include="Microsoft.AppCenter.Analytics">
988-
<Version>4.1.0</Version>
989+
<Version>4.2.0</Version>
989990
</PackageReference>
990991
<PackageReference Include="Microsoft.AppCenter.Crashes">
991-
<Version>4.1.0</Version>
992+
<Version>4.2.0</Version>
992993
</PackageReference>
993994
<PackageReference Include="Microsoft.Data.Sqlite.Core">
994995
<Version>5.0.4</Version>
@@ -1036,7 +1037,7 @@
10361037
<Version>2.0.1</Version>
10371038
</PackageReference>
10381039
<PackageReference Include="Newtonsoft.Json">
1039-
<Version>12.0.3</Version>
1040+
<Version>13.0.1</Version>
10401041
</PackageReference>
10411042
<PackageReference Include="NLog">
10421043
<Version>4.7.8</Version>

Files/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
x:Class="Files.UserControls.MultitaskingControl.HorizontalMultitaskingControl"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
6-
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
7-
xmlns:converters="using:Files.Converters"
85
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
96
xmlns:local="using:Files.UserControls.MultitaskingControl"
107
xmlns:local1="using:Files"
@@ -182,7 +179,9 @@
182179
<Setter.Value>
183180
<TransitionCollection>
184181
<AddDeleteThemeTransition />
182+
<ContentThemeTransition />
185183
<ReorderThemeTransition />
184+
<EntranceThemeTransition IsStaggeringEnabled="False" />
186185
</TransitionCollection>
187186
</Setter.Value>
188187
</Setter>
@@ -360,7 +359,7 @@
360359
</Style>
361360

362361
<Style x:Key="UndockedTabViewItemStyle" TargetType="muxc:TabViewItem">
363-
<Setter Property="HorizontalContentAlignment" Value="Left" />
362+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
364363
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
365364
<Setter Property="Template">
366365
<Setter.Value>
@@ -819,6 +818,7 @@
819818
ContextFlyout="{StaticResource TabFlyout}"
820819
CornerRadius="4"
821820
Height="36"
821+
HorizontalAlignment="Stretch"
822822
DragEnter="TabViewItem_DragEnter"
823823
DragLeave="TabViewItem_DragLeave"
824824
Drop="TabViewItem_Drop"

Files/UserControls/SidebarControl.xaml.cs

+26-2
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,27 @@ public sealed partial class SidebarControl : UserControl, INotifyPropertyChanged
5656
public bool IsOpen
5757
{
5858
get => (bool)GetValue(IsOpenProperty);
59-
set => SetValue(IsOpenProperty, value);
59+
set
60+
{
61+
if (this.IsLoaded)
62+
{
63+
SetValue(IsOpenProperty, value);
64+
}
65+
}
6066
}
6167

6268
public static readonly DependencyProperty IsCompactProperty = DependencyProperty.Register(nameof(IsCompact), typeof(bool), typeof(SidebarControl), new PropertyMetadata(false));
6369

6470
public bool IsCompact
6571
{
6672
get => (bool)GetValue(IsCompactProperty);
67-
set => SetValue(IsCompactProperty, value);
73+
set
74+
{
75+
if(this.IsLoaded)
76+
{
77+
SetValue(IsCompactProperty, value);
78+
}
79+
}
6880
}
6981

7082
public static readonly DependencyProperty EmptyRecycleBinCommandProperty = DependencyProperty.Register(nameof(EmptyRecycleBinCommand), typeof(ICommand), typeof(SidebarControl), new PropertyMetadata(null));
@@ -217,6 +229,18 @@ public void UnpinItem_Click(object sender, RoutedEventArgs e)
217229
}
218230
}
219231

232+
public static GridLength GetSidebarCompactSize()
233+
{
234+
if (App.Current.Resources.TryGetValue("NavigationViewCompactPaneLength", out object paneLength))
235+
{
236+
if (paneLength is double paneLengthDouble)
237+
{
238+
return new GridLength(paneLengthDouble);
239+
}
240+
}
241+
return new GridLength(200);
242+
}
243+
220244
private void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
221245
{
222246
if (args.InvokedItem == null || args.InvokedItemContainer == null)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
using Files.UserControls;
2+
using Files.Views;
3+
using Microsoft.Toolkit.Mvvm.ComponentModel;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.ComponentModel;
7+
using System.Linq;
8+
using System.Runtime.CompilerServices;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
using Windows.UI.Core;
12+
using Windows.UI.Xaml;
13+
using Windows.UI.Xaml.Controls;
14+
15+
namespace Files.ViewModels
16+
{
17+
public class AdaptiveSidebarViewModel : ObservableObject, IDisposable
18+
{
19+
public static readonly GridLength CompactSidebarWidth = SidebarControl.GetSidebarCompactSize();
20+
public event EventHandler<WindowCompactStateChangedEventArgs> WindowCompactStateChanged;
21+
private bool isWindowCompactSize;
22+
23+
public bool IsWindowCompactSize
24+
{
25+
get => isWindowCompactSize;
26+
set
27+
{
28+
if (isWindowCompactSize != value)
29+
{
30+
isWindowCompactSize = value;
31+
WindowCompactStateChanged?.Invoke(this, new WindowCompactStateChangedEventArgs(isWindowCompactSize));
32+
33+
OnPropertyChanged(nameof(IsWindowCompactSize));
34+
OnPropertyChanged(nameof(SidebarWidth));
35+
OnPropertyChanged(nameof(IsSidebarOpen));
36+
}
37+
}
38+
}
39+
40+
public GridLength SidebarWidth
41+
{
42+
get => IsWindowCompactSize || !IsSidebarOpen ? CompactSidebarWidth : App.AppSettings.SidebarWidth;
43+
set
44+
{
45+
if (IsWindowCompactSize || !IsSidebarOpen)
46+
{
47+
return;
48+
}
49+
if (App.AppSettings.SidebarWidth != value)
50+
{
51+
App.AppSettings.SidebarWidth = value;
52+
OnPropertyChanged(nameof(SidebarWidth));
53+
}
54+
}
55+
}
56+
57+
public bool IsSidebarOpen
58+
{
59+
get => !IsWindowCompactSize && App.AppSettings.IsSidebarOpen;
60+
set
61+
{
62+
if (IsWindowCompactSize)
63+
{
64+
return;
65+
}
66+
if (App.AppSettings.IsSidebarOpen != value)
67+
{
68+
App.AppSettings.IsSidebarOpen = value;
69+
OnPropertyChanged(nameof(SidebarWidth));
70+
OnPropertyChanged(nameof(IsSidebarOpen));
71+
}
72+
}
73+
}
74+
75+
public AdaptiveSidebarViewModel()
76+
{
77+
Window.Current.SizeChanged += Current_SizeChanged;
78+
App.AppSettings.PropertyChanged += AppSettings_PropertyChanged;
79+
Current_SizeChanged(null, null);
80+
}
81+
82+
private void AppSettings_PropertyChanged(object sender, PropertyChangedEventArgs e)
83+
{
84+
switch (e.PropertyName)
85+
{
86+
case nameof(App.AppSettings.SidebarWidth):
87+
OnPropertyChanged(nameof(SidebarWidth));
88+
break;
89+
90+
case nameof(App.AppSettings.IsSidebarOpen):
91+
if (App.AppSettings.IsSidebarOpen != IsSidebarOpen)
92+
{
93+
OnPropertyChanged(nameof(IsSidebarOpen));
94+
}
95+
break;
96+
}
97+
}
98+
99+
private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
100+
{
101+
if ((Window.Current.Content as Frame).CurrentSourcePageType != typeof(Settings))
102+
{
103+
if (IsWindowCompactSize != Window.Current.Bounds.Width <= 750)
104+
{
105+
IsWindowCompactSize = Window.Current.Bounds.Width <= 750;
106+
}
107+
}
108+
}
109+
110+
111+
public void Dispose()
112+
{
113+
Window.Current.SizeChanged -= Current_SizeChanged;
114+
App.AppSettings.PropertyChanged -= AppSettings_PropertyChanged;
115+
}
116+
}
117+
118+
public class WindowCompactStateChangedEventArgs
119+
{
120+
public bool IsWindowCompact { get; set; }
121+
122+
public WindowCompactStateChangedEventArgs(bool isCompact)
123+
{
124+
IsWindowCompact = isCompact;
125+
}
126+
}
127+
}

Files/Views/MainPage.xaml

+36-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
77
xmlns:i="using:Microsoft.Xaml.Interactivity"
8-
xmlns:icore="using:Microsoft.Xaml.Interactions.Core"
8+
xmlns:icore="using:Microsoft.Xaml.Interactions.Core"
9+
xmlns:converters="using:Files.Converters"
10+
xmlns:usercontrols="using:Files.UserControls.MultitaskingControl"
11+
xmlns:local1="using:Files" xmlns:viewmodels="using:Files.ViewModels"
912
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
1013
KeyboardAcceleratorPlacementMode="Hidden"
1114
NavigationCacheMode="Required"
1215
mc:Ignorable="d">
13-
16+
<Page.DataContext>
17+
<viewmodels:MainPageViewModel/>
18+
</Page.DataContext>
19+
<Page.Resources>
20+
<converters:WidthToRightMargin x:Key="WidthToRightMarginConverter" />
21+
</Page.Resources>
1422
<Page.KeyboardAccelerators>
1523
<KeyboardAccelerator
1624
Key="Number1"
@@ -141,6 +149,31 @@
141149
</Page.KeyboardAccelerators>
142150

143151
<Grid TabFocusNavigation="Cycle">
144-
<ContentPresenter Content="{x:Bind ViewModel.SelectedTabItem.Control, Mode=OneWay}" />
152+
<Grid.ColumnDefinitions>
153+
<ColumnDefinition
154+
x:Name="SidebarColumn"
155+
Width="{x:Bind SidebarAdaptiveViewModel.SidebarWidth, Mode=OneWay}" />
156+
<ColumnDefinition Width="*" />
157+
</Grid.ColumnDefinitions>
158+
<Grid
159+
x:Name="DragArea"
160+
Margin="38,0,0,0"
161+
Grid.ColumnSpan="2"
162+
Canvas.ZIndex="3"
163+
Height="40"
164+
VerticalAlignment="Top"
165+
HorizontalAlignment="Stretch"
166+
Background="Transparent"
167+
Loaded="DragArea_Loaded" />
168+
<Grid x:Name="RightMarginGrid" Padding="2,0,0,0"
169+
Canvas.ZIndex="4" VerticalAlignment="Top" Grid.Column="1">
170+
<usercontrols:HorizontalMultitaskingControl
171+
x:Name="horizontalMultitaskingControl"
172+
x:FieldModifier="public"
173+
Height="50"
174+
x:Load="{x:Bind converters:MultiBooleanConverter.OrConvert(AppSettings.IsHorizontalTabStripOn, local1:App.InteractionViewModel.IsHorizontalTabStripVisible), Mode=OneWay}"
175+
Loaded="HorizontalMultitaskingControl_Loaded" />
176+
</Grid>
177+
<ContentPresenter Grid.ColumnSpan="2" Content="{x:Bind ((viewmodels:MainPageViewModel)DataContext).SelectedTabItem.Control, Mode=OneWay}" />
145178
</Grid>
146179
</Page>

0 commit comments

Comments
 (0)