Skip to content
Merged

Dev #69

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
14 changes: 9 additions & 5 deletions Trdo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Linq;
Expand All @@ -26,7 +27,7 @@
private readonly UISettings _uiSettings = new();
private Mutex? _singleInstanceMutex;
private EventWaitHandle? _trayIconRestoreEvent;
private DispatcherQueueTimer? _trayIconWatchdogTimer;

Check warning on line 30 in Trdo/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'App._trayIconWatchdogTimer' is never used

Check warning on line 30 in Trdo/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'App._trayIconWatchdogTimer' is never used
private DispatcherQueueTimer? _restoreEventMonitorTimer;

/// <summary>
Expand Down Expand Up @@ -240,12 +241,15 @@
{
try
{
UISettings uiSettings = new();
Color foregroundColor = uiSettings.GetColorValue(UIColorType.Foreground);
// Read the system (taskbar) theme, not the app theme.
// SystemUsesLightTheme = 0 means dark taskbar, 1 means light taskbar.
using RegistryKey? key = Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize");
object? value = key?.GetValue("SystemUsesLightTheme");
if (value is int intVal)
return intVal == 0;

// In dark mode, foreground color is light (high RGB values)
// In light mode, foreground color is dark (low RGB values)
return (foregroundColor.R + foregroundColor.G + foregroundColor.B) > 384;
return true;
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion Trdo/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="40087JoeFinApps.Trdo"
Publisher="CN=153F3B0F-BA3D-4964-8098-71AC78A1DF6A"
Version="1.7.1.0" />
Version="1.8.0.0" />

<mp:PhoneIdentity PhoneProductId="fa86867b-3ba1-44b4-b776-ea2ad8aea4c7" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
24 changes: 23 additions & 1 deletion Trdo/Pages/PlayingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
</Page.Resources>

<Grid RowDefinitions="Auto,Auto,*,Auto,Auto,Auto" RowSpacing="12">
<Grid.ContextFlyout>
<MenuFlyout x:Name="PageContextMenu" Opening="PageContextMenu_Opening">
<MenuFlyoutItem
x:Name="ShowVolumeMenuItem"
Click="ShowVolumeSlider_Click"
Text="Show Volume Slider">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE767;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</Grid.ContextFlyout>

<Grid>
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -222,7 +234,17 @@
</Grid>

<!-- Volume Control -->
<Grid Grid.Row="3" ColumnSpacing="4">
<Grid
x:Name="VolumeControlGrid"
Grid.Row="3"
Background="Transparent"
ColumnSpacing="8"
PointerWheelChanged="VolumeControl_PointerWheelChanged">
<Grid.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Click="HideVolumeSlider_Click" Text="Hide Volume Slider" />
</MenuFlyout>
</Grid.ContextFlyout>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
Expand Down
34 changes: 34 additions & 0 deletions Trdo/Pages/PlayingPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using System;
using System.Diagnostics;
Expand Down Expand Up @@ -64,6 +65,11 @@
UpdateStationSelection();
UpdateFavoriteButtonState();

// Restore volume slider visibility from persisted setting
VolumeControlGrid.Visibility = SettingsService.IsVolumeSliderVisible
? Visibility.Visible
: Visibility.Collapsed;

// Find the ShellViewModel from the parent page
_shellViewModel = FindShellViewModel();
Debug.WriteLine($"[PlayingPage] ShellViewModel found: {_shellViewModel != null}");
Expand Down Expand Up @@ -341,7 +347,7 @@
{
Debug.WriteLine($"[PlayingPage] Visit Station Site clicked: {station.Name}");
// Navigate to AddStation page in edit mode with the station data
ViewModel.VisitWebsite(station);

Check warning on line 350 in Trdo/Pages/PlayingPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 350 in Trdo/Pages/PlayingPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
}
}

Expand Down Expand Up @@ -396,4 +402,32 @@

Debug.WriteLine("=== StationsListView_SelectionChanged END ===");
}

private void VolumeControl_PointerWheelChanged(object sender, PointerRoutedEventArgs e)
{
int delta = e.GetCurrentPoint((UIElement)sender).Properties.MouseWheelDelta;
double change = (delta / 120.0) * 0.02;
ViewModel.Volume = Math.Clamp(ViewModel.Volume + change, 0, 1);
e.Handled = true;
}

private void HideVolumeSlider_Click(object sender, RoutedEventArgs e)
{
VolumeControlGrid.Visibility = Visibility.Collapsed;
SettingsService.IsVolumeSliderVisible = false;
}

private void ShowVolumeSlider_Click(object sender, RoutedEventArgs e)
{
VolumeControlGrid.Visibility = Visibility.Visible;
SettingsService.IsVolumeSliderVisible = true;
}

private void PageContextMenu_Opening(object sender, object e)
{
if (VolumeControlGrid.Visibility == Visibility.Visible)
{
((MenuFlyout)sender).Hide();
}
}
}
133 changes: 78 additions & 55 deletions Trdo/Pages/SearchStation.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,67 +73,90 @@
ItemsSource="{x:Bind ViewModel.SearchResults, Mode=OneWay}"
SelectionMode="None"
Visibility="{x:Bind ViewModel.SearchResults.Count, Mode=OneWay, Converter={StaticResource HasItemsVisibilityConverter}}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:RadioBrowserStation">
<Grid
Margin="0,6"
ColumnDefinitions="Auto,*"
ColumnSpacing="12"
RowDefinitions="Auto,Auto,Auto"
RowSpacing="4">

<!-- Favicon -->
<Border
Margin="0,4"
Padding="6"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8">
<Grid
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Width="40"
Height="40"
VerticalAlignment="Top"
Visibility="{x:Bind Favicon, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}">
<Border Background="{ThemeResource CardBackgroundFillColorSecondaryBrush}" CornerRadius="6">
<Image Source="{x:Bind Favicon, Converter={StaticResource StringToImageSourceConverter}, Mode=OneWay}" Stretch="UniformToFill" />
</Border>
</Grid>
ColumnDefinitions="Auto,*"
ColumnSpacing="12"
RowDefinitions="Auto,Auto,Auto"
RowSpacing="4">

<!-- Station Name -->
<TextBlock
Grid.Row="0"
Grid.Column="1"
FontWeight="SemiBold"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<!-- Favicon -->
<Grid
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Width="40"
Height="40"
VerticalAlignment="Top"
Visibility="{x:Bind Favicon, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}">
<Border Background="{ThemeResource CardBackgroundFillColorSecondaryBrush}" CornerRadius="6">
<Image Source="{x:Bind Favicon, Converter={StaticResource StringToImageSourceConverter}, Mode=OneWay}" Stretch="UniformToFill" />
</Border>
</Grid>

<!-- Station Info -->
<TextBlock
Grid.Row="1"
Grid.Column="1"
TextWrapping="WrapWholeWords">
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Country}" />
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text=" • " />
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Tags}" />
</TextBlock>
<!-- Station Name -->
<TextBlock
Grid.Row="0"
Grid.Column="1"
FontWeight="SemiBold"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />

<!-- Add Button -->
<Button
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,4,0,0"
Click="AddStationButton_Click"
Content="Add Station"
Style="{StaticResource AccentButtonStyle}"
Tag="{x:Bind}" />
</Grid>
<!-- Station Info -->
<TextBlock
Grid.Row="1"
Grid.Column="1"
TextWrapping="WrapWholeWords">
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Country}" />
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text=" • " />
<Run
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Tags}" />
</TextBlock>

<!-- Preview & Add Buttons -->
<StackPanel
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,4,0,0"
Orientation="Horizontal"
Spacing="8">
<Button
Click="PreviewButton_Click"
Tag="{x:Bind}"
ToolTipService.ToolTip="Preview station">
<FontIcon FontSize="14" Glyph="&#xE768;" />
</Button>
<Button
Click="AddStationButton_Click"
Content="Add Station"
Style="{StaticResource AccentButtonStyle}"
Tag="{x:Bind}" />
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand Down
Loading
Loading