Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7d2b5f0
First refactoring to clear the method.
QuaintMako Nov 4, 2022
ed8e2de
Now can move with keyboard to last blade.
QuaintMako Nov 7, 2022
3aafa7c
Now can move focus to the next blade.
QuaintMako Nov 7, 2022
5beaf77
Can now move focus on previous blade.
QuaintMako Nov 7, 2022
0b5b348
Refactored methods a bit and added conditions to prevent out of range.
QuaintMako Nov 7, 2022
67bad6c
Removed unneeded code.
QuaintMako Nov 7, 2022
9662a30
Small cleaning.
QuaintMako Nov 7, 2022
639fbdd
Merge branch 'main' into 10109_CrashArrowColumnView
QuaintMako Nov 7, 2022
9378d52
Optimized blade dismission.
QuaintMako Nov 7, 2022
1a59a70
Merge branch '10109_CrashArrowColumnView' of https://github.com/Quain…
QuaintMako Nov 7, 2022
4ebd6d7
Now correctly selecting the first object when moving right.
QuaintMako Nov 7, 2022
d64d8e2
Separating the logic to move to previous or next blade.
QuaintMako Nov 7, 2022
6a1bd1b
Now correctly select the parent folder.
QuaintMako Nov 7, 2022
611e1de
Removed unused param.
QuaintMako Nov 7, 2022
1e3897c
Reworked the index processing.
QuaintMako Nov 7, 2022
e8b1f50
Merge branch 'main' into 10109_CrashArrowColumnView
QuaintMako Nov 7, 2022
259749c
Merge branch '10109_CrashArrowColumnView' of https://github.com/Quain…
QuaintMako Nov 7, 2022
c96cfde
Merge branch 'main' into 10109_CrashArrowColumnView
QuaintMako Nov 8, 2022
3c98714
Removed unnecessary comments
QuaintMako Nov 8, 2022
de76610
Merge branch 'main' into 10109_CrashArrowColumnView
QuaintMako Nov 11, 2022
11e7df2
Fixes given by PR review.
QuaintMako Nov 11, 2022
ea266aa
Merge branch 'main' into 10109_CrashArrowColumnView
QuaintMako Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,20 +399,21 @@ private async void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
}
else if (e.Key == VirtualKey.Left) // Left arrow: select parent folder (previous column)
{
if (!IsRenamingItem && !ParentShellPageInstance.ToolbarViewModel.IsEditModeEnabled)
{
if ((ParentShellPageInstance as ColumnShellPage)?.ColumnParams.Column > 0)
FocusManager.TryMoveFocus(FocusNavigationDirection.Previous);
e.Handled = true;
}
if (IsRenamingItem || (ParentShellPageInstance is not null && ParentShellPageInstance.ToolbarViewModel.IsEditModeEnabled) )
return;

var currentBladeIndex = (ParentShellPageInstance is ColumnShellPage associatedColumnShellPage) ? associatedColumnShellPage.ColumnParams.Column : 0;
this.FindAscendant<ColumnViewBrowser>()?.MoveFocusToPreviousBlade(currentBladeIndex);
e.Handled = true;
}
else if (e.Key == VirtualKey.Right) // Right arrow: switch focus to next column
{
if (!IsRenamingItem && !ParentShellPageInstance.ToolbarViewModel.IsEditModeEnabled)
{
FocusManager.TryMoveFocus(FocusNavigationDirection.Next);
e.Handled = true;
}
if (IsRenamingItem || (ParentShellPageInstance is not null && ParentShellPageInstance.ToolbarViewModel.IsEditModeEnabled))
return;

var currentBladeIndex = (ParentShellPageInstance is ColumnShellPage associatedColumnShellPage) ? associatedColumnShellPage.ColumnParams.Column : 0;
this.FindAscendant<ColumnViewBrowser>()?.MoveFocusToNextBlade(currentBladeIndex + 1);
e.Handled = true;
}
}

Expand All @@ -429,7 +430,7 @@ protected override void Page_CharacterReceived(UIElement sender, CharacterReceiv

if
(
Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Enter) == CoreVirtualKeyStates.Down ||
InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Enter) == CoreVirtualKeyStates.Down ||
focusedElement is Button ||
focusedElement is TextBox ||
focusedElement is PasswordBox ||
Expand Down
44 changes: 44 additions & 0 deletions src/Files.App/Views/LayoutModes/ColumnViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,50 @@ public void NavigateUp()
}
}

public void MoveFocusToPreviousBlade(int currentBladeIndex)
{
if (currentBladeIndex <= 0)
return;

DismissOtherBlades(currentBladeIndex);

var activeBlade = ColumnHost.ActiveBlades[currentBladeIndex - 1];
activeBlade.Focus(FocusState.Programmatic);

var activeBladeColumnViewBase = RetrieveBladeColumnViewBase(activeBlade);
if (activeBladeColumnViewBase is null)
return;

//This allows to deselect and reselect the parent folder, hence forcing the refocus.
var selectedItem = activeBladeColumnViewBase.FileList.SelectedItem;
activeBladeColumnViewBase.FileList.SelectedItem = null;
activeBladeColumnViewBase.FileList.SelectedItem = selectedItem;
}

public void MoveFocusToNextBlade(int currentBladeIndex)
{
if (currentBladeIndex >= ColumnHost.ActiveBlades.Count)
return;

var activeBlade = ColumnHost.ActiveBlades[currentBladeIndex];
activeBlade.Focus(FocusState.Programmatic);

var activeBladeColumnViewBase = RetrieveBladeColumnViewBase(activeBlade);
if (activeBladeColumnViewBase is not null)
activeBladeColumnViewBase.FileList.SelectedIndex = 0;
}

private ColumnViewBase? RetrieveBladeColumnViewBase(BladeItem blade)
{
if (blade.Content is not Frame activeBladeFrame)
return null;

if (activeBladeFrame.Content is not ColumnShellPage activeBladePage)
return null;

return activeBladePage.SlimContentPage as ColumnViewBase;
}

public void SetSelectedPathOrNavigate(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null)
{
var destPath = navArgs is not null ? (navArgs.IsSearchResultPage ? navArgs.SearchPathParam : navArgs.NavPathParam) : navigationPath;
Expand Down