Skip to content

Commit 00948d6

Browse files
fix: use white button icons in dark mode
Agent-Logs-Url: https://github.com/TransactionProcessing/TransactionMobile/sessions/7483231e-3678-4592-9c16-cf991c3a1788 Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
1 parent e61efa9 commit 00948d6

22 files changed

Lines changed: 135 additions & 36 deletions

TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<TapGestureRecognizer Command="{Binding GoToMobileTopupCommand}" AutomationId="MobileTopupCard"/>
5252
</Frame.GestureRecognizers>
5353
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
54-
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
54+
<Image Source="{AppThemeBinding Light=transactionsbutton.svg, Dark=transactionsbutton-dark.svg}" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
5555
<Label Text="Mobile Topup"
5656
FontSize="13"
5757
FontAttributes="Bold"
@@ -66,7 +66,7 @@
6666
<TapGestureRecognizer Command="{Binding GoToBillPaymentCommand}" AutomationId="BillPaymentCard"/>
6767
</Frame.GestureRecognizers>
6868
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
69-
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
69+
<Image Source="{AppThemeBinding Light=transactionsbutton.svg, Dark=transactionsbutton-dark.svg}" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
7070
<Label Text="Bill Payment"
7171
FontSize="13"
7272
FontAttributes="Bold"
@@ -81,7 +81,7 @@
8181
<TapGestureRecognizer Command="{Binding GoToVoucherCommand}" AutomationId="VoucherCard"/>
8282
</Frame.GestureRecognizers>
8383
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
84-
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
84+
<Image Source="{AppThemeBinding Light=transactionsbutton.svg, Dark=transactionsbutton-dark.svg}" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
8585
<Label Text="Voucher"
8686
FontSize="13"
8787
FontAttributes="Bold"
@@ -96,7 +96,7 @@
9696
<TapGestureRecognizer Command="{Binding GoToAdminCommand}" AutomationId="AdminCard"/>
9797
</Frame.GestureRecognizers>
9898
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
99-
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
99+
<Image Source="{AppThemeBinding Light=transactionsbutton.svg, Dark=transactionsbutton-dark.svg}" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
100100
<Label Text="Admin"
101101
FontSize="13"
102102
FontAttributes="Bold"
@@ -124,4 +124,4 @@
124124

125125
</VerticalStackLayout>
126126
</ScrollView>
127-
</common:NoBackWithoutLogoutPage>
127+
</common:NoBackWithoutLogoutPage>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace TransactionProcessor.Mobile.Pages.Common;
2+
3+
internal static class ThemeButtonImageSource
4+
{
5+
public static String Get(String imageSource)
6+
{
7+
if (Application.Current?.RequestedTheme != AppTheme.Dark)
8+
{
9+
return imageSource;
10+
}
11+
12+
String imageExtension = Path.GetExtension(imageSource);
13+
String imageName = Path.GetFileNameWithoutExtension(imageSource);
14+
15+
return $"{imageName}-dark{imageExtension}";
16+
}
17+
}

TransactionProcessor.Mobile/Pages/MyAccount/MyAccountPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</LinearGradientBrush>
1818
</Grid.Background>
1919
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4" Padding="20">
20-
<Image Source="profilebutton.svg" HeightRequest="52" WidthRequest="52" HorizontalOptions="Center"/>
20+
<Image Source="{AppThemeBinding Light=profilebutton.svg, Dark=profilebutton-dark.svg}" HeightRequest="52" WidthRequest="52" HorizontalOptions="Center"/>
2121
<Label Text="{Binding Title}"
2222
AutomationId="{Binding Title}"
2323
FontSize="20"

TransactionProcessor.Mobile/Pages/MyAccount/MyAccountPage.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private Frame CreateOptionTile(ListViewItem modelOption, Int32 rowCount)
5353

5454
Image icon = new Image
5555
{
56-
Source = iconSource,
56+
Source = ThemeButtonImageSource.Get(iconSource),
5757
HeightRequest = 36,
5858
WidthRequest = 36,
5959
HorizontalOptions = LayoutOptions.Center
@@ -105,5 +105,6 @@ private async void DarkThemeSwitch_Toggled(Object sender,
105105
}
106106

107107
await this.viewModel.SetDarkTheme(e.Value);
108+
this.LoadOptions(this.viewModel);
108109
}
109110
}

TransactionProcessor.Mobile/Pages/Reports/ReportsPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</LinearGradientBrush>
1818
</Grid.Background>
1919
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4" Padding="20">
20-
<Image Source="reportbutton.svg" HeightRequest="44" WidthRequest="44" HorizontalOptions="Center"/>
20+
<Image Source="{AppThemeBinding Light=reportbutton.svg, Dark=reportbutton-dark.svg}" HeightRequest="44" WidthRequest="44" HorizontalOptions="Center"/>
2121
<Label Text="{Binding Title}"
2222
AutomationId="{Binding Title}"
2323
FontSize="20"
@@ -46,4 +46,4 @@
4646

4747
</VerticalStackLayout>
4848
</ScrollView>
49-
</common:NoBackWithoutLogoutPage>
49+
</common:NoBackWithoutLogoutPage>

TransactionProcessor.Mobile/Pages/Reports/ReportsPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private Frame CreateReportTile(ListViewItem modelOption, Int32 rowCount)
5050

5151
Image icon = new Image
5252
{
53-
Source = iconSource,
53+
Source = ThemeButtonImageSource.Get(iconSource),
5454
HeightRequest = 36,
5555
WidthRequest = 36,
5656
HorizontalOptions = LayoutOptions.Center
@@ -92,4 +92,4 @@ private Frame CreateReportTile(ListViewItem modelOption, Int32 rowCount)
9292

9393
return tile;
9494
}
95-
}
95+
}

TransactionProcessor.Mobile/Pages/Support/SupportPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</LinearGradientBrush>
1818
</Grid.Background>
1919
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4" Padding="20">
20-
<Image Source="supportbutton.svg" HeightRequest="52" WidthRequest="52" HorizontalOptions="Center"/>
20+
<Image Source="{AppThemeBinding Light=supportbutton.svg, Dark=supportbutton-dark.svg}" HeightRequest="52" WidthRequest="52" HorizontalOptions="Center"/>
2121
<Label Text="{Binding Title}"
2222
AutomationId="{Binding Title}"
2323
FontSize="20"
@@ -65,4 +65,4 @@
6565

6666
</VerticalStackLayout>
6767
</ScrollView>
68-
</common:NoBackWithoutLogoutPage>
68+
</common:NoBackWithoutLogoutPage>

TransactionProcessor.Mobile/Pages/Support/SupportPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private Frame CreateSupportTile(String title, String iconSource, String automati
4242

4343
Image icon = new Image
4444
{
45-
Source = iconSource,
45+
Source = ThemeButtonImageSource.Get(iconSource),
4646
HeightRequest = 36,
4747
WidthRequest = 36,
4848
HorizontalOptions = LayoutOptions.Center
@@ -72,4 +72,4 @@ private Frame CreateSupportTile(String title, String iconSource, String automati
7272
return tile;
7373
}
7474
}
75-
}
75+
}

TransactionProcessor.Mobile/Pages/Transactions/Admin/AdminPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<TapGestureRecognizer Command="{Binding ReconciliationCommand}"/>
4242
</Frame.GestureRecognizers>
4343
<HorizontalStackLayout Spacing="10" HorizontalOptions="Center">
44-
<Image Source="transactionsbutton.svg" HeightRequest="36" WidthRequest="36" VerticalOptions="Center"/>
44+
<Image Source="{AppThemeBinding Light=transactionsbutton.svg, Dark=transactionsbutton-dark.svg}" HeightRequest="36" WidthRequest="36" VerticalOptions="Center"/>
4545
<Label Text="Reconciliation"
4646
FontSize="15"
4747
FontAttributes="Bold"
@@ -58,4 +58,4 @@
5858
</VerticalStackLayout>
5959
</VerticalStackLayout>
6060
</ScrollView>
61-
</ContentPage>
61+
</ContentPage>

TransactionProcessor.Mobile/Pages/Transactions/BillPayment/BillPaymentSelectOperatorPage.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using TransactionProcessor.Mobile.BusinessLogic.Common;
33
using TransactionProcessor.Mobile.BusinessLogic.Models;
44
using TransactionProcessor.Mobile.BusinessLogic.ViewModels.Transactions;
5+
using TransactionProcessor.Mobile.Pages.Common;
56

67
namespace TransactionProcessor.Mobile.Pages.Transactions.BillPayment;
78

@@ -43,7 +44,7 @@ private Frame CreateOperatorTile(ContractOperatorModel modelOperator, Int32 rowC
4344

4445
Image icon = new Image
4546
{
46-
Source = "transactionsbutton.svg",
47+
Source = ThemeButtonImageSource.Get("transactionsbutton.svg"),
4748
HeightRequest = 36,
4849
WidthRequest = 36,
4950
HorizontalOptions = LayoutOptions.Center
@@ -77,4 +78,4 @@ private Frame CreateOperatorTile(ContractOperatorModel modelOperator, Int32 rowC
7778

7879
return tile;
7980
}
80-
}
81+
}

0 commit comments

Comments
 (0)