Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement toggle for displaying thumbnail image in the background #315

Merged
merged 2 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion ModernFlyouts/Controls/SessionControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns:resx="clr-namespace:ModernFlyouts.Properties"
xmlns:input="clr-namespace:ModernFlyouts.Input"
xmlns:designTime="clr-namespace:ModernFlyouts.DesignTime"
xmlns:local="clr-namespace:ModernFlyouts"
mc:Ignorable="d" d:DataContext="{d:DesignInstance designTime:MockMediaSession}"
Width="{DynamicResource FlyoutWidth}" VerticalAlignment="Top">
<Border CornerRadius="{DynamicResource FlyoutCornerRadius}">
Expand All @@ -22,7 +23,8 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Opacity="0.5" CornerRadius="{DynamicResource FlyoutCornerRadius}" ClipToBounds="True">
<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Opacity="0.5" CornerRadius="{DynamicResource FlyoutCornerRadius}" ClipToBounds="True"
Visibility="{Binding Source={x:Static local:FlyoutHandler.Instance}, Path=UIManager.ShowGSMTCThumbnailInBackground, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border.OpacityMask>
<RadialGradientBrush x:Name="thumbnailBGOpacityBrush" x:FieldModifier="private"
GradientOrigin="1,0.5" RadiusX="1" RadiusY="1" Center="1,0.5">
Expand Down
1 change: 0 additions & 1 deletion ModernFlyouts/Controls/SessionControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public bool AlignThumbnailToRight
get => (bool)GetValue(AlignThumbnailToRightProperty);
set => SetValue(AlignThumbnailToRightProperty, value);
}

#endregion

public SessionControl()
Expand Down
6 changes: 6 additions & 0 deletions ModernFlyouts/Helpers/AppDataHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ public static bool AlignGSMTCThumbnailToRight
get => GetValue(DefaultValuesStore.AlignGSMTCThumbnailToRight);
set => SetValue(value);
}

public static bool ShowGSMTCThumbnailInBackground
{
get => GetValue(DefaultValuesStore.ShowGSMTCThumbnailInBackground);
set => SetValue(value);
}

public static int MaxVerticalSessionControlsCount
{
Expand Down
2 changes: 2 additions & 0 deletions ModernFlyouts/Helpers/DefaultValuesStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ internal class DefaultValuesStore
public const bool UseColoredTrayIcon = true;

public const bool AlignGSMTCThumbnailToRight = true;

public const bool ShowGSMTCThumbnailInBackground = true;

public const int MaxVerticalSessionControlsCount = 1;

Expand Down
3 changes: 3 additions & 0 deletions ModernFlyouts/Navigation/AudioModulePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<ui:ToggleSwitch Header="{x:Static resx:Strings.AudioFlyoutHelper_ThumbnailAlignment}"
OnContent="{x:Static resx:Strings.Settings_Right}" OffContent="{x:Static resx:Strings.Settings_Left}"
IsOn="{Binding UIManager.AlignGSMTCThumbnailToRight}" />
<ui:ToggleSwitch Header="{x:Static resx:Strings.AudioFlyoutHelper_ThumbnailInBackground}"
OnContent="{x:Static resx:Strings.Settings_On}" OffContent="{x:Static resx:Strings.Settings_Off}"
IsOn="{Binding UIManager.ShowGSMTCThumbnailInBackground}" />
<ui:RadioButtons x:Name="orientationCmbBox" x:FieldModifier="private"
Header="{x:Static resx:Strings.AudioFlyoutHelper_SessionsPanelOrientation}"
ItemTemplate="{StaticResource LocalizedEnumItemTemplate}"
Expand Down
11 changes: 10 additions & 1 deletion ModernFlyouts/Properties/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ModernFlyouts/Properties/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,7 @@
<data name="Settings.RestartRequired" xml:space="preserve">
<value>Neustart erforderlich, um einige Änderungen anzuwenden</value>
</data>
<data name="AudioFlyoutHelper.ThumbnailInBackground" xml:space="preserve">
<value>Thumbnail im Hintergrund anzeigen</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ModernFlyouts/Properties/Strings.en-GB.resx
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,7 @@
<data name="Settings.RestartRequired" xml:space="preserve">
<value>Restart required to apply some changes</value>
</data>
<data name="AudioFlyoutHelper.ThumbnailInBackground" xml:space="preserve">
<value>Display thumbnail in background</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ModernFlyouts/Properties/Strings.en-NZ.resx
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,7 @@
<data name="Settings.RestartRequired" xml:space="preserve">
<value>Restart required to apply some changes</value>
</data>
<data name="AudioFlyoutHelper.ThumbnailInBackground" xml:space="preserve">
<value>Display thumbnail in background</value>
</data>
</root>
3 changes: 3 additions & 0 deletions ModernFlyouts/Properties/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
<data name="AudioFlyoutHelper.ThumbnailAlignment" xml:space="preserve">
<value>Thumbnail alignment</value>
</data>
<data name="AudioFlyoutHelper.ThumbnailInBackground" xml:space="preserve">
<value>Display thumbnail in background</value>
</data>
<data name="Close" xml:space="preserve">
<value>Close</value>
</data>
Expand Down
15 changes: 15 additions & 0 deletions ModernFlyouts/UI/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@ public bool AlignGSMTCThumbnailToRight
}
}
}

private bool showGSMTCThumbnailInBackground = DefaultValuesStore.ShowGSMTCThumbnailInBackground;

public bool ShowGSMTCThumbnailInBackground
{
get => showGSMTCThumbnailInBackground;
set
{
if (SetProperty(ref showGSMTCThumbnailInBackground, value))
{
AppDataHelper.ShowGSMTCThumbnailInBackground = value;
}
}
}

private Orientation sessionsPanelOrientation = DefaultValuesStore.SessionsPanelOrientation;

Expand Down Expand Up @@ -211,6 +225,7 @@ public void Initialize(FlyoutWindow flyoutWindow)
TopBarVisibility = AppDataHelper.TopBarVisibility;
FlyoutTimeout = AppDataHelper.FlyoutTimeout;
AlignGSMTCThumbnailToRight = AppDataHelper.AlignGSMTCThumbnailToRight;
ShowGSMTCThumbnailInBackground = AppDataHelper.ShowGSMTCThumbnailInBackground;
MaxVerticalSessionControlsCount = AppDataHelper.MaxVerticalSessionControlsCount;
SessionsPanelOrientation = AppDataHelper.SessionsPanelOrientation;

Expand Down