-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit * Initial commit of sleep timer flyout UI * Added animations * Added percent left * Added animations * Created dedicated service class for sleep timer * Pausing sleep timer if focus timer starts * Added more time options * Added localizations * Code cleanup
- Loading branch information
Showing
63 changed files
with
885 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<UserControl | ||
x:Class="AmbientSounds.Controls.SleepTimerButton" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:ex="using:JeniusApps.Common.UI.Uwp" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:strings="using:AmbientSounds.Strings" | ||
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls" | ||
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" | ||
xmlns:vm="using:AmbientSounds.ViewModels" | ||
xmlns:winui="using:Microsoft.UI.Xaml.Controls" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<Button | ||
AutomationProperties.Name="{x:Bind strings:Resources.SleepTimerText}" | ||
Style="{StaticResource SmallSubtleIconButton}" | ||
ToolTipService.ToolTip="{x:Bind strings:Resources.SleepTimerText}"> | ||
<Grid> | ||
<FontIcon | ||
FontFamily="{StaticResource FluentUIGlyphs}" | ||
FontSize="{StaticResource SmallIconSize}" | ||
Glyph="{StaticResource GlyphMoon}" | ||
Visibility="{x:Bind ex:UIExtensions.InvertBoolToVis(ViewModel.CountdownVisible), Mode=OneWay}" /> | ||
|
||
<Grid ui:VisualExtensions.NormalizedCenterPoint="0.5" Visibility="{x:Bind ViewModel.CountdownVisible, Mode=OneWay}"> | ||
<animations:Implicit.ShowAnimations> | ||
<animations:OpacityAnimation | ||
From="0" | ||
To="1" | ||
Duration="0:0:3" /> | ||
<animations:ScaleAnimation | ||
From="0.5" | ||
To="1" | ||
Duration="0:0:3" /> | ||
</animations:Implicit.ShowAnimations> | ||
|
||
<winui:ProgressRing | ||
Width="20" | ||
Height="20" | ||
Foreground="{ThemeResource AccentFillColorDisabledBrush}" | ||
IsIndeterminate="False" | ||
Maximum="100" | ||
Value="100" /> | ||
<winui:ProgressRing | ||
Width="20" | ||
Height="20" | ||
Foreground="{ThemeResource AccentFillColorDefaultBrush}" | ||
IsIndeterminate="False" | ||
Maximum="100" | ||
Value="{x:Bind ViewModel.PercentLeft, Mode=OneWay}" /> | ||
<FontIcon | ||
FontFamily="{StaticResource FluentUIGlyphs}" | ||
FontSize="8" | ||
Foreground="{ThemeResource AccentFillColorDefaultBrush}" | ||
Glyph="{StaticResource GlyphMoonSolid}" /> | ||
</Grid> | ||
</Grid> | ||
|
||
<Button.Flyout> | ||
<Flyout Placement="Bottom"> | ||
<Flyout.FlyoutPresenterStyle> | ||
<Style BasedOn="{StaticResource DefaultFlyoutPresenterStyle}" TargetType="FlyoutPresenter"> | ||
<Setter Property="Padding" Value="12" /> | ||
</Style> | ||
</Flyout.FlyoutPresenterStyle> | ||
|
||
<Grid Width="200"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<TextBlock | ||
FontSize="12" | ||
Foreground="{ThemeResource AccentFillColorDefaultBrush}" | ||
Text="{x:Bind strings:Resources.SleepTimerText}" /> | ||
|
||
<Rectangle | ||
Grid.Row="1" | ||
Margin="0,4,0,0" | ||
HorizontalAlignment="Stretch" | ||
Style="{StaticResource ModuleDividerRectStyle}" /> | ||
|
||
<TextBlock | ||
Grid.Row="2" | ||
Margin="0,4,0,0" | ||
HorizontalAlignment="Left" | ||
ui:VisualExtensions.NormalizedCenterPoint="0.5" | ||
FontSize="16" | ||
Text="{x:Bind ViewModel.TimeLeft, Mode=OneWay}" | ||
Typography.NumeralAlignment="Tabular" | ||
Visibility="{x:Bind ViewModel.CountdownVisible, Mode=OneWay}"> | ||
<animations:Implicit.ShowAnimations> | ||
<animations:OpacityAnimation | ||
From="0" | ||
To="1" | ||
Duration="0:0:0.3" /> | ||
<animations:ScaleAnimation | ||
From="0.5" | ||
To="1" | ||
Duration="0:0:0.3" /> | ||
<animations:TranslationAnimation | ||
From="0,24,0" | ||
To="0" | ||
Duration="0:0:0.3" /> | ||
</animations:Implicit.ShowAnimations> | ||
</TextBlock> | ||
|
||
<ItemsControl | ||
Grid.Row="3" | ||
Margin="0,6,0,0" | ||
ItemsSource="{x:Bind ViewModel.Options}"> | ||
<animations:Implicit.Animations> | ||
<animations:OffsetAnimation Duration="0:0:0.3" /> | ||
</animations:Implicit.Animations> | ||
<ItemsControl.ItemsPanel> | ||
<ItemsPanelTemplate> | ||
<toolkit:WrapPanel HorizontalSpacing="{StaticResource SoundCardSpacingDouble}" VerticalSpacing="{StaticResource SoundCardSpacingDouble}" /> | ||
</ItemsPanelTemplate> | ||
</ItemsControl.ItemsPanel> | ||
<ItemsControl.ItemTemplate> | ||
<DataTemplate x:DataType="vm:SleepTimerOptionsViewModel"> | ||
<ToggleButton | ||
AutomationProperties.Name="{x:Bind Label}" | ||
Command="{x:Bind StartCommand}" | ||
Content="{x:Bind Label}" | ||
FontSize="10" | ||
IsChecked="{x:Bind IsActive, Mode=OneWay}" /> | ||
</DataTemplate> | ||
</ItemsControl.ItemTemplate> | ||
</ItemsControl> | ||
|
||
<TextBlock | ||
Grid.Row="4" | ||
Margin="0,12,0,0" | ||
FontSize="10" | ||
Foreground="{ThemeResource TextFillColorTertiaryBrush}" | ||
Style="{StaticResource CaptionTextBlockStyle}" | ||
Text="{x:Bind strings:Resources.SleepTimerDescription}" | ||
TextWrapping="WrapWholeWords" | ||
Visibility="{x:Bind ViewModel.CountdownVisible, Mode=OneWay}"> | ||
<animations:Implicit.ShowAnimations> | ||
<animations:OpacityAnimation | ||
From="0" | ||
To="1" | ||
Duration="0:0:0.6" /> | ||
</animations:Implicit.ShowAnimations> | ||
</TextBlock> | ||
</Grid> | ||
</Flyout> | ||
</Button.Flyout> | ||
</Button> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using AmbientSounds.ViewModels; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Windows.UI.Xaml.Controls; | ||
|
||
namespace AmbientSounds.Controls; | ||
|
||
public sealed partial class SleepTimerButton : UserControl | ||
{ | ||
public SleepTimerButton() | ||
{ | ||
this.InitializeComponent(); | ||
this.DataContext = App.Services.GetRequiredService<SleepTimerViewModel>(); | ||
} | ||
|
||
public SleepTimerViewModel ViewModel => (SleepTimerViewModel)this.DataContext; | ||
|
||
public void Initialize() => ViewModel.Initialize(); | ||
|
||
public void Uninitialize() => ViewModel.Uninitialize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.