Skip to content

Commit

Permalink
Change description for "Show buttons in hidden UI" to "ShowFadeInButt…
Browse files Browse the repository at this point in the history
…onsOnHover"/"DisableFadeInButtonsOnHover". Add functionality and update translation strings.
  • Loading branch information
Ruben2776 committed Nov 2, 2024
1 parent 12f797b commit 38527e3
Show file tree
Hide file tree
Showing 20 changed files with 194 additions and 119 deletions.
4 changes: 4 additions & 0 deletions src/PicView.Avalonia/SettingsManagement/LanguageUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ public static void UpdateLanguage(MainViewModel vm)
vm.GetIsShowingBottomToolbarTranslation = SettingsHelper.Settings.UIProperties.ShowBottomNavBar
? TranslationHelper.Translation.HideBottomToolbar
: TranslationHelper.Translation.ShowBottomToolbar;

vm.GetIsShowingFadingUIButtonsTranslation = SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons
? TranslationHelper.Translation.DisableFadeInButtonsOnHover
: TranslationHelper.Translation.ShowFadeInButtonsOnHover;
}
}
26 changes: 24 additions & 2 deletions src/PicView.Avalonia/UI/HideInterfaceLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public static void AddHoverButtonEvents(Control parent, Control childControl, Ma
{
childControl.PointerEntered += delegate
{
if (!SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons)
{
return;
}

if (vm.ImageIterator is null)
{
parent.Opacity = 0;
Expand All @@ -162,6 +167,11 @@ public static void AddHoverButtonEvents(Control parent, Control childControl, Ma
};
parent.PointerEntered += async delegate
{
if (!SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons)
{
return;
}

await DoHoverButtonAnimation(isShown:true, parent, childControl, vm);
};
parent.PointerExited += async delegate
Expand Down Expand Up @@ -197,7 +207,7 @@ public static void AddHoverButtonEvents(Control parent, Control childControl, Ma

private static async Task DoHoverButtonAnimation(bool isShown, Control parent, MainViewModel vm)
{
if (_isHoverButtonAnimationRunning)
if (_isHoverButtonAnimationRunning || !SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons)
{
return;
}
Expand All @@ -223,7 +233,7 @@ private static async Task DoHoverButtonAnimation(bool isShown, Control parent, M
}
private static async Task DoHoverButtonAnimation(bool isShown, Control parent, Control childControl, MainViewModel vm)
{
if (_isHoverButtonAnimationRunning)
if (_isHoverButtonAnimationRunning || !SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons)
{
return;
}
Expand Down Expand Up @@ -273,4 +283,16 @@ public static async Task ToggleBottomGalleryShownInHiddenUI(MainViewModel vm)

await SettingsHelper.SaveSettingsAsync();
}

public static async Task ToggleFadeInButtonsOnHover(MainViewModel vm)
{
SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons = !SettingsHelper.Settings
.UIProperties.ShowAltInterfaceButtons;

vm.GetIsShowingFadingUIButtonsTranslation = SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons
? TranslationHelper.Translation.DisableFadeInButtonsOnHover
: TranslationHelper.Translation.ShowFadeInButtonsOnHover;

await SettingsHelper.SaveSettingsAsync();
}
}
23 changes: 23 additions & 0 deletions src/PicView.Avalonia/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ public bool IsFillSquareMenuChecked
public ReactiveCommand<Unit, Unit>? ChangeBackgroundCommand { get; }
public ReactiveCommand<Unit, Unit>? ToggleBottomNavBarCommand { get; }
public ReactiveCommand<Unit, Unit>? ToggleBottomGalleryShownInHiddenUICommand { get; }

public ReactiveCommand<Unit, Unit>? ToggleFadeInButtonsOnHoverCommand { get; }
public ReactiveCommand<Unit, Unit>? ToggleTaskbarProgressCommand { get; }
public ReactiveCommand<Unit, Unit>? ShowExifWindowCommand { get; }
public ReactiveCommand<Unit, Unit>? ShowAboutWindowCommand { get; }
Expand Down Expand Up @@ -691,6 +693,14 @@ public bool IsEditableTitlebarOpen
get => _isEditableTitlebarOpen;
set => this.RaiseAndSetIfChanged(ref _isEditableTitlebarOpen, value);
}

private bool _isShowingFadeButtons = SettingsHelper.Settings.UIProperties.ShowAltInterfaceButtons;

public bool IsShowingFadeButtons
{
get => _isShowingFadeButtons;
set => this.RaiseAndSetIfChanged(ref _isShowingFadeButtons, value);
}

#endregion Booleans

Expand Down Expand Up @@ -807,6 +817,14 @@ public string? GetIsShowingBottomToolbarTranslation
get => _getIsShowingBottomToolbarTranslation;
set => this.RaiseAndSetIfChanged(ref _getIsShowingBottomToolbarTranslation, value);
}

private string? _getIsShowingFadingUIButtonsTranslation;

public string? GetIsShowingFadingUIButtonsTranslation
{
get => _getIsShowingFadingUIButtonsTranslation;
set => this.RaiseAndSetIfChanged(ref _getIsShowingFadingUIButtonsTranslation, value);
}

private string? _getIsFlipped;

Expand Down Expand Up @@ -1955,6 +1973,11 @@ public MainViewModel(IPlatformSpecificService? platformSpecificService)
{
await HideInterfaceLogic.ToggleBottomGalleryShownInHiddenUI(this);
});

ToggleFadeInButtonsOnHoverCommand = ReactiveCommand.CreateFromTask(async() =>
{
await HideInterfaceLogic.ToggleFadeInButtonsOnHover(this);
});

ChangeCtrlZoomCommand = ReactiveCommand.CreateFromTask(FunctionsHelper.ChangeCtrlZoom);

Expand Down
18 changes: 18 additions & 0 deletions src/PicView.Avalonia/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,28 @@ public void UpdateLanguage()
AdvanceBy100Images = TranslationHelper.Translation.AdvanceBy100Images;
GoBackBy10Images = TranslationHelper.Translation.GoBackBy10Images;
GoBackBy100Images = TranslationHelper.Translation.GoBackBy100Images;
ShowFadeInButtonsOnHover = TranslationHelper.Translation.ShowFadeInButtonsOnHover;
DisableFadeInButtonsOnHover = TranslationHelper.Translation.DisableFadeInButtonsOnHover;
}

#region Strings

private string? _showFadeInButtonsOnHover;

public string? ShowFadeInButtonsOnHover
{
get => _showFadeInButtonsOnHover;
set => this.RaiseAndSetIfChanged(ref _showFadeInButtonsOnHover, value);
}

private string? _disableFadeInButtonsOnHover;

public string? DisableFadeInButtonsOnHover
{
get => _disableFadeInButtonsOnHover;
set => this.RaiseAndSetIfChanged(ref _disableFadeInButtonsOnHover, value);
}

private string? _advanceBy10Images;

public string? AdvanceBy10Images
Expand Down
112 changes: 86 additions & 26 deletions src/PicView.Avalonia/Views/AppearanceView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,32 +183,40 @@
Height="18"
Margin="10,0,10,0"
Width="18">
<Image.Source>
<DrawingImage>
<DrawingGroup>
<GeometryDrawing Geometry="F1 M3 19L3 5Q3 4.90175 3.00963 4.80397Q3.01926 4.70618 3.03843 4.60982Q3.0576 4.51345 3.08612 4.41943Q3.11464 4.32541 3.15224 4.23463Q3.18984 4.14386 3.23616 4.05721Q3.28247 3.97055 3.33706 3.88886Q3.39165 3.80716 3.45398 3.73121Q3.51631 3.65526 3.58579 3.58579Q3.65526 3.51631 3.73121 3.45398Q3.80716 3.39165 3.88886 3.33706Q3.97055 3.28247 4.05721 3.23616Q4.14386 3.18984 4.23463 3.15224Q4.32541 3.11464 4.41943 3.08612Q4.51345 3.0576 4.60982 3.03843Q4.70618 3.01926 4.80397 3.00963Q4.90175 3 5 3L19 3Q19.0983 3 19.196 3.00963Q19.2938 3.01926 19.3902 3.03843Q19.4865 3.0576 19.5806 3.08612Q19.6746 3.11464 19.7654 3.15224Q19.8561 3.18984 19.9428 3.23616Q20.0294 3.28247 20.1111 3.33706Q20.1928 3.39165 20.2688 3.45398Q20.3447 3.51631 20.4142 3.58579Q20.4837 3.65526 20.546 3.73121Q20.6084 3.80716 20.6629 3.88886Q20.7175 3.97055 20.7638 4.05721Q20.8102 4.14386 20.8478 4.23463Q20.8854 4.32541 20.9139 4.41943Q20.9424 4.51345 20.9616 4.60982Q20.9807 4.70618 20.9904 4.80397Q21 4.90175 21 5L21 19Q21 19.0983 20.9904 19.196Q20.9807 19.2938 20.9616 19.3902Q20.9424 19.4865 20.9139 19.5806Q20.8854 19.6746 20.8478 19.7654Q20.8102 19.8561 20.7638 19.9428Q20.7175 20.0294 20.6629 20.1111Q20.6084 20.1928 20.546 20.2688Q20.4837 20.3447 20.4142 20.4142Q20.3447 20.4837 20.2688 20.546Q20.1928 20.6084 20.1111 20.6629Q20.0294 20.7175 19.9428 20.7638Q19.8561 20.8102 19.7654 20.8478Q19.6746 20.8854 19.5806 20.9139Q19.4865 20.9424 19.3902 20.9616Q19.2938 20.9807 19.196 20.9904Q19.0983 21 19 21L5 21Q4.90175 21 4.80397 20.9904Q4.70618 20.9807 4.60982 20.9616Q4.51345 20.9424 4.41943 20.9139Q4.32541 20.8854 4.23463 20.8478Q4.14386 20.8102 4.05721 20.7638Q3.97055 20.7175 3.88886 20.6629Q3.80716 20.6084 3.73121 20.546Q3.65526 20.4837 3.58579 20.4142Q3.51631 20.3447 3.45398 20.2688Q3.39165 20.1928 3.33706 20.1111Q3.28247 20.0294 3.23616 19.9428Q3.18984 19.8561 3.15224 19.7654Q3.11464 19.6746 3.08612 19.5806Q3.0576 19.4865 3.03843 19.3902Q3.01926 19.2938 3.00963 19.196Q3 19.0983 3 19Z">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M3 15L21 15">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</Image.Source>
<DrawingImage>
<DrawingGroup>
<GeometryDrawing Geometry="F1 M3 19L3 5Q3 4.90175 3.00963 4.80397Q3.01926 4.70618 3.03843 4.60982Q3.0576 4.51345 3.08612 4.41943Q3.11464 4.32541 3.15224 4.23463Q3.18984 4.14386 3.23616 4.05721Q3.28247 3.97055 3.33706 3.88886Q3.39165 3.80716 3.45398 3.73121Q3.51631 3.65526 3.58579 3.58579Q3.65526 3.51631 3.73121 3.45398Q3.80716 3.39165 3.88886 3.33706Q3.97055 3.28247 4.05721 3.23616Q4.14386 3.18984 4.23463 3.15224Q4.32541 3.11464 4.41943 3.08612Q4.51345 3.0576 4.60982 3.03843Q4.70618 3.01926 4.80397 3.00963Q4.90175 3 5 3L19 3Q19.0983 3 19.196 3.00963Q19.2938 3.01926 19.3902 3.03843Q19.4865 3.0576 19.5806 3.08612Q19.6746 3.11464 19.7654 3.15224Q19.8561 3.18984 19.9428 3.23616Q20.0294 3.28247 20.1111 3.33706Q20.1928 3.39165 20.2688 3.45398Q20.3447 3.51631 20.4142 3.58579Q20.4837 3.65526 20.546 3.73121Q20.6084 3.80716 20.6629 3.88886Q20.7175 3.97055 20.7638 4.05721Q20.8102 4.14386 20.8478 4.23463Q20.8854 4.32541 20.9139 4.41943Q20.9424 4.51345 20.9616 4.60982Q20.9807 4.70618 20.9904 4.80397Q21 4.90175 21 5L21 19Q21 19.0983 20.9904 19.196Q20.9807 19.2938 20.9616 19.3902Q20.9424 19.4865 20.9139 19.5806Q20.8854 19.6746 20.8478 19.7654Q20.8102 19.8561 20.7638 19.9428Q20.7175 20.0294 20.6629 20.1111Q20.6084 20.1928 20.546 20.2688Q20.4837 20.3447 20.4142 20.4142Q20.3447 20.4837 20.2688 20.546Q20.1928 20.6084 20.1111 20.6629Q20.0294 20.7175 19.9428 20.7638Q19.8561 20.8102 19.7654 20.8478Q19.6746 20.8854 19.5806 20.9139Q19.4865 20.9424 19.3902 20.9616Q19.2938 20.9807 19.196 20.9904Q19.0983 21 19 21L5 21Q4.90175 21 4.80397 20.9904Q4.70618 20.9807 4.60982 20.9616Q4.51345 20.9424 4.41943 20.9139Q4.32541 20.8854 4.23463 20.8478Q4.14386 20.8102 4.05721 20.7638Q3.97055 20.7175 3.88886 20.6629Q3.80716 20.6084 3.73121 20.546Q3.65526 20.4837 3.58579 20.4142Q3.51631 20.3447 3.45398 20.2688Q3.39165 20.1928 3.33706 20.1111Q3.28247 20.0294 3.23616 19.9428Q3.18984 19.8561 3.15224 19.7654Q3.11464 19.6746 3.08612 19.5806Q3.0576 19.4865 3.03843 19.3902Q3.01926 19.2938 3.00963 19.196Q3 19.0983 3 19Z">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M3 15L21 15">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M15 8L12 11L9 8">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</Image>
<TextBlock
Classes="txt"
Expand Down Expand Up @@ -329,5 +337,57 @@
</StackPanel>
</Button>

<Button
Background="Transparent"
BorderThickness="0"
Classes="altHover"
Command="{CompiledBinding ToggleFadeInButtonsOnHoverCommand}"
Foreground="{StaticResource SecondaryTextColor}"
Margin="0,0,0,10"
Padding="0,10,0,10"
Width="300">
<StackPanel Orientation="Horizontal">
<Image
Height="18"
Margin="10,0,10,0"
Width="18">
<Image.Source>
<DrawingImage>
<DrawingGroup>
<GeometryDrawing Geometry="F1 M12.034 12.681Q12.007 12.6132 12.0005 12.5404Q11.9941 12.4677 12.0088 12.3962Q12.0236 12.3247 12.0582 12.2604Q12.0928 12.1961 12.1445 12.1445Q12.1961 12.0928 12.2604 12.0582Q12.3247 12.0236 12.3962 12.0088Q12.4677 11.9941 12.5404 12.0005Q12.6132 12.007 12.681 12.034L21.681 15.534Q21.7534 15.5623 21.8137 15.6112Q21.8741 15.6601 21.9168 15.725Q21.9595 15.7899 21.9805 15.8647Q22.0014 15.9395 21.9987 16.0172Q21.996 16.0948 21.9698 16.168Q21.9437 16.2412 21.8966 16.3029Q21.8495 16.3647 21.7858 16.4093Q21.7222 16.4538 21.648 16.477L18.204 17.545Q18.0875 17.581 17.983 17.644Q17.8785 17.707 17.7923 17.7933Q17.706 17.8795 17.643 17.984Q17.58 18.0885 17.544 18.205L16.477 21.648Q16.4538 21.7222 16.4093 21.7858Q16.3647 21.8495 16.3029 21.8966Q16.2412 21.9437 16.168 21.9699Q16.0948 21.996 16.0172 21.9987Q15.9395 22.0014 15.8647 21.9805Q15.7899 21.9595 15.725 21.9168Q15.6601 21.8741 15.6112 21.8137Q15.5623 21.7534 15.534 21.681L12.034 12.681Z">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M21 11L21 5Q21 4.90175 20.9904 4.80397Q20.9807 4.70618 20.9616 4.60982Q20.9424 4.51345 20.9139 4.41943Q20.8854 4.32541 20.8478 4.23463Q20.8102 4.14386 20.7638 4.05721Q20.7175 3.97055 20.6629 3.88886Q20.6084 3.80716 20.546 3.73121Q20.4837 3.65526 20.4142 3.58579Q20.3447 3.51631 20.2688 3.45398Q20.1928 3.39165 20.1111 3.33706Q20.0294 3.28247 19.9428 3.23616Q19.8561 3.18984 19.7654 3.15224Q19.6746 3.11464 19.5806 3.08612Q19.4865 3.0576 19.3902 3.03843Q19.2938 3.01926 19.196 3.00963Q19.0983 3 19 3L5 3Q4.90175 3 4.80397 3.00963Q4.70619 3.01926 4.60982 3.03843Q4.51345 3.0576 4.41943 3.08612Q4.32541 3.11464 4.23463 3.15224Q4.14386 3.18984 4.05721 3.23616Q3.97055 3.28247 3.88886 3.33706Q3.80716 3.39165 3.73121 3.45398Q3.65526 3.51631 3.58579 3.58579Q3.51631 3.65526 3.45398 3.73121Q3.39165 3.80716 3.33706 3.88886Q3.28247 3.97055 3.23616 4.05721Q3.18984 4.14386 3.15224 4.23463Q3.11464 4.32541 3.08612 4.41943Q3.0576 4.51345 3.03843 4.60982Q3.01926 4.70619 3.00963 4.80397Q3 4.90175 3 5L3 19Q3 19.0983 3.00963 19.196Q3.01926 19.2938 3.03843 19.3902Q3.0576 19.4865 3.08612 19.5806Q3.11464 19.6746 3.15224 19.7654Q3.18984 19.8561 3.23616 19.9428Q3.28247 20.0294 3.33706 20.1111Q3.39165 20.1928 3.45398 20.2688Q3.51631 20.3447 3.58579 20.4142Q3.65526 20.4837 3.73121 20.546Q3.80716 20.6084 3.88886 20.6629Q3.97055 20.7175 4.05721 20.7638Q4.14386 20.8102 4.23463 20.8478Q4.32541 20.8854 4.41943 20.9139Q4.51345 20.9424 4.60982 20.9616Q4.70618 20.9807 4.80397 20.9904Q4.90175 21 5 21L11 21">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
Classes="txt"
Foreground="{StaticResource SecondaryTextColor}"
Margin="0"
MaxWidth="240"
Padding="0,1,5,0"
Text="{CompiledBinding GetIsShowingFadingUIButtonsTranslation,
Mode=OneWay}" />
</StackPanel>
</Button>

</StackPanel>
</UserControl>
Loading

0 comments on commit 38527e3

Please sign in to comment.