Skip to content

Commit c9fbbaf

Browse files
committed
Merge branch 'master' of github.com:timschneeb/GalaxyBudsClient
2 parents 2531f31 + 9266684 commit c9fbbaf

File tree

26 files changed

+153
-41
lines changed

26 files changed

+153
-41
lines changed

Diff for: GalaxyBudsClient/Interface/Controls/EarbudIcon.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.ComponentModel;
33
using System.IO;
44
using Avalonia;
@@ -30,6 +30,7 @@ public EarbudIcon()
3030
BluetoothImpl.Instance.Connected += OnConnected;
3131
Settings.MainSettingsPropertyChanged += OnMainSettingsPropertyChanged;
3232
Settings.DevicePropertyChanged += OnDevicePropertyChanged;
33+
Settings.Data.PropertyChanged += OnSettingsDataPropertyChanged;
3334
UpdateEarbudIcons();
3435
}
3536

@@ -76,9 +77,15 @@ private void OnBluetoothPropertyChanged(object? sender, PropertyChangedEventArgs
7677
});
7778
}
7879

80+
private void OnSettingsDataPropertyChanged(object? sender, PropertyChangedEventArgs e)
81+
{
82+
if (e.PropertyName == nameof(Settings.Data.ColorOverride))
83+
UpdateEarbudIcons();
84+
}
85+
7986
private void UpdateEarbudIcons()
8087
{
81-
var color = BluetoothImpl.Instance.Device.Current?.DeviceColor ?? DeviceMessageCache.Instance.ExtendedStatusUpdate?.DeviceColor;
88+
var color = Settings.Data.ColorOverride ?? BluetoothImpl.Instance.Device.Current?.DeviceColor ?? DeviceMessageCache.Instance.ExtendedStatusUpdate?.DeviceColor;
8289
if (Settings.Data.RealisticEarbudImages && color != null &&
8390
BluetoothImpl.Instance.DeviceSpec.Supports(Features.DeviceColor))
8491
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Avalonia.Markup.Xaml;
5+
using GalaxyBudsClient.Model.Constants;
6+
using GalaxyBudsClient.Message;
7+
using GalaxyBudsClient.Platform;
8+
using System.Reflection;
9+
using GalaxyBudsClient.Model.Attributes;
10+
using GalaxyBudsClient.Model.Config;
11+
12+
namespace GalaxyBudsClient.Interface.MarkupExtensions;
13+
14+
public class DeviceColorBindingSource : MarkupExtension
15+
{
16+
public override object ProvideValue(IServiceProvider serviceProvider)
17+
{
18+
var currentDevice = BluetoothImpl.Instance.Device.Current;
19+
if (currentDevice == null)
20+
return Array.Empty<DeviceIds>();
21+
22+
// Get current device's model and color
23+
var currentModel = currentDevice.Model;
24+
var currentColor = currentDevice.DeviceColor ??
25+
DeviceMessageCache.Instance.ExtendedStatusUpdate?.DeviceColor ??
26+
DeviceIds.Unknown;
27+
28+
// Filter DeviceIds based on current model
29+
var values = Enum.GetValues(typeof(DeviceIds))
30+
.Cast<DeviceIds>()
31+
.Where(x => {
32+
var field = typeof(DeviceIds).GetField(x.ToString());
33+
var attr = field?.GetCustomAttribute<AssociatedModelAttribute>();
34+
return attr != null && attr.Model == currentModel;
35+
})
36+
.OrderBy(x => x.ToString())
37+
.ToList();
38+
39+
// Move current color to top if it exists in the list
40+
if (currentColor != DeviceIds.Unknown && values.Contains(currentColor))
41+
{
42+
values.Remove(currentColor);
43+
values.Insert(0, currentColor);
44+
}
45+
46+
// Set the initial value if no override is set
47+
if (Settings.Data.ColorOverride == null)
48+
{
49+
Settings.Data.ColorOverride = currentColor;
50+
}
51+
52+
return values;
53+
}
54+
}

Diff for: GalaxyBudsClient/Interface/Pages/SettingsPage.axaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<ext:LocalizationAwareComboBoxBehavior />
7777
</Interaction.Behaviors>
7878
</controls:SettingsComboBoxItem>
79-
79+
8080
<controls:SettingsSliderItem
8181
Content="{ext:Translate {x:Static i18N:Keys.SettingsBlurstrength}}"
8282
Description="{ext:Translate {x:Static i18N:Keys.SettingsBlurstrengthDescription}}"
@@ -102,6 +102,14 @@
102102
Symbol="LocalLanguage"
103103
ItemsSource="{Binding Source={ext:LocalesBindingSource}}"
104104
SelectedValue="{Binding Locale, Source={x:Static config:Settings.Data}}" />
105+
106+
<controls:SettingsComboBoxItem Name="ColorOverride"
107+
Content="{ext:Translate {x:Static i18N:Keys.SettingsColorOverride}}"
108+
Description="{ext:Translate {x:Static i18N:Keys.SettingsColorOverrideDescription}}"
109+
Symbol="ColorFill"
110+
IsEnabled="{Binding RealisticEarbudImages, Source={x:Static config:Settings.Data}}"
111+
ItemsSource="{Binding ., Source={ext:DeviceColorBindingSource}}"
112+
SelectedValue="{Binding ColorOverride, Source={x:Static config:Settings.Data}}" />
105113

106114
<controls:SettingsSwitchItem Content="{ext:Translate {x:Static i18N:Keys.SettingsRealisticEarbudIcons}}"
107115
Description="{ext:Translate {x:Static i18N:Keys.SettingsRealisticEarbudIconsDescription}}"

Diff for: GalaxyBudsClient/Model/Config/SettingsData.cs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class SettingsData : ReactiveObject
3636
[Reactive] public TemperatureUnits TemperatureUnit { set; get; } = TemperatureUnits.Celsius;
3737
[Reactive] public bool RealisticEarbudImages { set; get; } = true;
3838
[Reactive] public bool ShowSidebar { set; get; } = Settings.DefaultShowSidebar;
39+
[Reactive] public DeviceIds? ColorOverride { set; get; }
3940

4041
/* Connections */
4142
[Reactive] public bool UseBluetoothWinRt { set; get; } = true;

Diff for: GalaxyBudsClient/i18n/en.axaml

+2
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ Measure level: Select a vertical span to measure the battery level difference be
427427
<sys:String x:Key="settings_minimize_tray_description">Keep in background instead of terminating the app</sys:String>
428428
<sys:String x:Key="settings_realistic_earbud_icons">Use realistic earbud images</sys:String>
429429
<sys:String x:Key="settings_realistic_earbud_icons_description">Display realistic &amp; color-aware images of your earbuds, if they support it</sys:String>
430+
<sys:String x:Key="settings_color_override">Earbud color override</sys:String>
431+
<sys:String x:Key="settings_color_override_description">Change the displayed color of your earbuds in the app</sys:String>
430432
<sys:String x:Key="settings_nav_sidebar">Navigation sidebar</sys:String>
431433
<sys:String x:Key="settings_nav_sidebar_description">Show or collapse the navigation buttons on the left hand side</sys:String>
432434
<sys:String x:Key="settings_tray_settings">Tray icon &amp; startup</sys:String>

Diff for: GalaxyBudsClient/i18n/tr.axaml

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ Bittiğinde, toplanan tüm veriler için bir dizin seçmeniz istenecektir.
375375
<sys:String x:Key="settings_accent">Vurgu rengi</sys:String>
376376
<sys:String x:Key="settings_realistic_earbud_icons">Kulaklıkların gerçekçi resimlerini kullan</sys:String>
377377
<sys:String x:Key="settings_realistic_earbud_icons_description">Destekliyorsa, kulaklıklarınızın gerçekçi ve renk uyumlu resimlerini görüntüler</sys:String>
378+
<sys:String x:Key="settings_color_override">Kulaklık resminin rengi</sys:String>
379+
<sys:String x:Key="settings_color_override_description">Kulaklıklarınızın uygulamada görünen rengini değiştirin.</sys:String>
378380
<sys:String x:Key="settings_accent_description">Özel bir vurgu rengi seçin</sys:String>
379381
<sys:String x:Key="settings_transitions_description">Kaydırma geçişlerini etkinleştir</sys:String>
380382
<sys:String x:Key="settings_localization_disable">Dil</sys:String>

Diff for: meta/cn.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>100%</td><td>No missing strings</td></tr>
7+
<tr><td>99%</td><td>2 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
1111

1212
<table>
1313
<tr><th>Key</th><th>Original string</th></tr>
14+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
15+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
1416

1517
</table>
1618

Diff for: meta/cz.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>100%</td><td>No missing strings</td></tr>
7+
<tr><td>99%</td><td>2 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
1111

1212
<table>
1313
<tr><th>Key</th><th>Original string</th></tr>
14+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
15+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
1416

1517
</table>
1618

Diff for: meta/de.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>44%</td><td>311 missing string(s)</td></tr>
7+
<tr><td>44%</td><td>313 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -193,6 +193,8 @@ Measure level: Select a vertical span to measure the battery level difference be
193193
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
194194
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
195195
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
196+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
197+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
196198
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
197199
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
198200
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/es.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>26%</td><td>411 missing string(s)</td></tr>
7+
<tr><td>26%</td><td>413 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -274,6 +274,8 @@ Measure level: Select a vertical span to measure the battery level difference be
274274
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
275275
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
276276
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
277+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
278+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
277279
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
278280
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
279281
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/fr.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>54%</td><td>252 missing string(s)</td></tr>
7+
<tr><td>54%</td><td>254 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -187,6 +187,8 @@ Measure level: Select a vertical span to measure the battery level difference be
187187
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
188188
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
189189
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
190+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
191+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
190192
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
191193
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
192194
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/gr.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>44%</td><td>310 missing string(s)</td></tr>
7+
<tr><td>44%</td><td>312 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -195,6 +195,8 @@ Measure level: Select a vertical span to measure the battery level difference be
195195
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
196196
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
197197
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
198+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
199+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
198200
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
199201
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
200202
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/hu.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>60%</td><td>220 missing string(s)</td></tr>
7+
<tr><td>60%</td><td>222 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -176,6 +176,8 @@ Measure level: Select a vertical span to measure the battery level difference be
176176
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
177177
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
178178
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
179+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
180+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
179181
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
180182
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
181183
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/il.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>60%</td><td>220 missing string(s)</td></tr>
7+
<tr><td>60%</td><td>222 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -176,6 +176,8 @@ Measure level: Select a vertical span to measure the battery level difference be
176176
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
177177
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
178178
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
179+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
180+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
179181
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
180182
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
181183
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/in.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>26%</td><td>408 missing string(s)</td></tr>
7+
<tr><td>26%</td><td>410 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -273,6 +273,8 @@ Measure level: Select a vertical span to measure the battery level difference be
273273
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
274274
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
275275
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
276+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
277+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
276278
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
277279
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
278280
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/it.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>46%</td><td>296 missing string(s)</td></tr>
7+
<tr><td>46%</td><td>298 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -216,6 +216,8 @@ Measure level: Select a vertical span to measure the battery level difference be
216216
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
217217
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
218218
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
219+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
220+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
219221
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
220222
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
221223
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

Diff for: meta/ja.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is auto-generated and automatically updated. Do not modify this file m
44

55
<table>
66
<tr><th>Progress</th><th>Count</th></tr>
7-
<tr><td>26%</td><td>411 missing string(s)</td></tr>
7+
<tr><td>26%</td><td>413 missing string(s)</td></tr>
88
</table>
99

1010
### Missing strings
@@ -274,6 +274,8 @@ Measure level: Select a vertical span to measure the battery level difference be
274274
<tr><td><code>settings_localization_description</code></td><td>Change the app language</td></tr>
275275
<tr><td><code>settings_realistic_earbud_icons</code></td><td>Use realistic earbud images</td></tr>
276276
<tr><td><code>settings_realistic_earbud_icons_description</code></td><td>Display realistic & color-aware images of your earbuds, if they support it</td></tr>
277+
<tr><td><code>settings_color_override</code></td><td>Earbud color override</td></tr>
278+
<tr><td><code>settings_color_override_description</code></td><td>Change the displayed color of your earbuds in the app</td></tr>
277279
<tr><td><code>settings_nav_sidebar</code></td><td>Navigation sidebar</td></tr>
278280
<tr><td><code>settings_nav_sidebar_description</code></td><td>Show or collapse the navigation buttons on the left hand side</td></tr>
279281
<tr><td><code>settings_tray_settings</code></td><td>Tray icon & startup</td></tr>

0 commit comments

Comments
 (0)