Skip to content

Commit 8bb207a

Browse files
authored
Merge pull request #47 from YBTopaz8/6-search-exp-by-text
- Added categories for Expenditures in code
2 parents 51b4dad + 1f092a8 commit 8bb207a

File tree

11 files changed

+115
-23
lines changed

11 files changed

+115
-23
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace FlowHub.Main.Utilities;
10+
11+
public class EnumHelper
12+
{
13+
public static string GetEnumDescription(Enum value)
14+
{
15+
FieldInfo field = value.GetType().GetField(value.ToString())!;
16+
DescriptionAttribute? attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
17+
return attribute == null ? value.ToString() : attribute.Description;
18+
}
19+
}

FlowHub.Main/ViewModels/Expenditures/UpSertExpenditureVM.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void PageLoaded()
7070
{
7171
IsAddTaxesChecked = true;
7272
}
73-
73+
7474
ResultingBalance = ActiveUser.PocketMoney;
7575
TotalAmountSpent = SingleExpenditureDetails.AmountSpent;
7676
}

FlowHub.Main/Views/Desktop/Expenditures/ManageExpendituresD.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
xmlns:material="clr-namespace:UraniumUI.Material.Controls;assembly=UraniumUI.Material"
88
xmlns:models="clr-namespace:FlowHub.Models;assembly=FlowHub.Models"
99
xmlns:viewModels="clr-namespace:FlowHub.Main.ViewModels.Expenditures"
10+
xmlns:utilities="clr-namespace:FlowHub.Main.Utilities"
1011
x:DataType="viewModels:ManageExpendituresVM"
1112
x:Name="page"
1213
Title="Manage Expenditures">
1314

1415
<toolkit:DockLayout>
16+
<toolkit:DockLayout.Resources>
17+
<ResourceDictionary>
18+
<utilities:EnumHelper x:Key="EnumHelper"/>
19+
</ResourceDictionary>
20+
</toolkit:DockLayout.Resources>
21+
1522
<Label FontSize="21" HorizontalOptions="Center"
1623
Margin="8"
1724
toolkit:DockLayout.DockPosition="Top">
@@ -118,6 +125,8 @@
118125
</material:DataGridColumn>
119126

120127
<material:DataGridColumn Binding="{Binding Reason}" Title="Reason"/>
128+
<material:DataGridColumn Binding="{Binding Category, Converter={StaticResource EnumHelper}}" Title="Reason"/>
129+
121130

122131
<material:DataGridColumn Title="Amount Spent">
123132
<material:DataGridColumn.CellItemTemplate>

FlowHub.Main/Views/Desktop/Settings/UserSettingsPageD.xaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
<Button Text="Security"/>
2424
<Button Text="Data Export"/>
2525
</VerticalStackLayout>
26-
<VerticalStackLayout Margin="25,20,20,0" >
27-
26+
<VerticalStackLayout Margin="25,20,20,0">
2827
<Image Source="{AppThemeBinding Dark=user_icon_d.png, Light=user_icon_l.png}" HeightRequest="80"/>
2928
<Label Text="{Binding UserName}" FontSize="38" FontAttributes="Bold" HorizontalTextAlignment="Center"/>
3029

@@ -33,7 +32,6 @@
3332
<toolkit:DockLayout Margin="10,10" >
3433
<Label Text="Finances" FontAttributes="Bold" FontSize="22" />
3534
<HorizontalStackLayout Spacing="80" HorizontalOptions="CenterAndExpand">
36-
3735
<VerticalStackLayout HorizontalOptions="Start">
3836
<Label FontAttributes="Bold" FontSize="20" >
3937
<Label.Text>

FlowHub.Main/Views/Mobile/Settings/ApplicationSettingsPageM.xaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
<Label toolkit:DockLayout.DockPosition="Left" Text="Left" WidthRequest="80" />
1111
<Label toolkit:DockLayout.DockPosition="Right" Text="Right" WidthRequest="90" />
1212
<Label Text="Center" />-->
13-
<Label Text="Yvan"/>
13+
<Label Text="FlowHub - v0.0.8 Made With Love :D " HorizontalOptions="Center" Margin="2" FontSize="24"/>
14+
<Label Text="By Yvan Brunel" HorizontalOptions="Center" Margin="2" FontSize="24"/>
15+
<Label Text="Tap Here to view GitHub Repo" HorizontalTextAlignment="Center" VerticalOptions="Start" HeightRequest="30"
16+
FontSize="21">
17+
<Label.GestureRecognizers>
18+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
19+
</Label.GestureRecognizers>
20+
</Label>
1421
</toolkit:DockLayout>
1522
</ContentPage>

FlowHub.Main/Views/Mobile/Settings/ApplicationSettingsPageM.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ public ApplicationSettingsPageM()
88
{
99
InitializeComponent();
1010
}
11+
12+
private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
13+
{
14+
var uri = new Uri("https://github.com/YBTopaz8/FlowHub-MAUI");
15+
await Browser.Default.OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
16+
await Clipboard.SetTextAsync(uri.ToString());
17+
}
1118
}

FlowHub.Main/Views/Mobile/Settings/EditUserSettingsPageM.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<Label Text="{Binding SelectCountryCurrency}" Grid.Column="1" VerticalOptions="Center" FontSize="16" FontAttributes="Bold"/>
3535
</Grid>
3636

37-
<ListView ItemsSource="{Binding Taxes}" Header="Taxes" SeparatorVisibility="None" VerticalScrollBarVisibility="Never">
37+
<ListView ItemsSource="{Binding Taxes}" Header="Taxes" IsVisible="false" SeparatorVisibility="None" VerticalScrollBarVisibility="Never">
3838
<ListView.ItemTemplate>
3939
<DataTemplate x:DataType="models:TaxModel">
4040
<ViewCell>

FlowHub.Main/Views/Mobile/Settings/UserSettingsPageM.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133
<Label Text="{Binding UserCurrency}" FontSize="15" FontAttributes="Bold"/>
134134
</VerticalStackLayout>
135135
<Rectangle />
136-
137-
<VerticalStackLayout Margin="5,15" Spacing="10">
136+
137+
<VerticalStackLayout Margin="5,15" Spacing="10" IsVisible="false">
138138
<Label Text="Taxes" FontSize="13"/>
139139
<ListView ItemsSource="{Binding ActiveUser.Taxes}" SelectionMode="None" SeparatorVisibility="None" VerticalScrollBarVisibility="Never">
140140
<ListView.ItemTemplate>

FlowHub.Main/Views/UpSertExpendituresPopUp.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
xmlns:viewModels="clr-namespace:FlowHub.Main.ViewModels.Expenditures"
1313
x:DataType="viewModels:UpSertExpenditureVM"
1414
CanBeDismissedByTappingOutsideOfPopup="False"
15-
Size="{OnPlatform Android ='350,400', WinUI='400,400'} "
15+
1616
Color="Transparent"
1717
x:Name="page">
1818

1919

20-
<Border Margin="8,0"
20+
<Border Margin="13,10"
2121
Stroke="{AppThemeBinding Dark={StaticResource BackGroundDark}, Light=White}"
2222
StrokeThickness="0"
2323
StrokeShape="RoundRectangle 12">

FlowHub.Main/Views/UpSertExpendituresPopUp.xaml.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,32 @@ public UpSertExpendituresPopUp(UpSertExpenditureVM vm)
1515
this.BindingContext = vm;
1616
viewModel.PageLoadedCommand.Execute(null);
1717

18-
#if ANDROID
19-
var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
20-
var orientation = mainDisplayInfo.Orientation;
21-
var width = mainDisplayInfo.Width;
22-
var height = mainDisplayInfo.Height;
23-
var density = mainDisplayInfo.Density;
24-
var smallestWidth = Math.Min(width, height) * density;
25-
var popupWidth = smallestWidth * 0.115;
26-
27-
var popupHeight = (smallestWidth * 0.13) > 401 ? 350 : smallestWidth * 0.13;
28-
Size = new Size(popupWidth, popupHeight);
29-
#elif WINDOWS
18+
//#if ANDROID
19+
// var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
20+
// var orientation = mainDisplayInfo.Orientation;
21+
// var width = mainDisplayInfo.Width;
22+
// var height = mainDisplayInfo.Height;
23+
// var density = mainDisplayInfo.Density;
24+
// var smallestWidth = Math.Min(width, height) / density;
25+
// var popupWidth = smallestWidth * 0.9;
26+
27+
// double popupHeight = 0;
28+
// if (smallestWidth < 415)
29+
// {
30+
// if ((smallestWidth * 0.13) > 401)
31+
// {
32+
// popupHeight = 350;
33+
// }
34+
// else
35+
// {
36+
// popupHeight = (double)(smallestWidth * 0.92);
37+
// }
38+
39+
// }
40+
// //else if(smallestWidth)
41+
42+
// Size = new Size(popupWidth, popupHeight);
43+
#if WINDOWS
3044
this.Size = new Size(400, 400);
3145
#endif
3246
viewModel.PropertyChanged += ViewModel_PropertyChanged;
@@ -46,7 +60,6 @@ private void ViewModel_PropertyChanged(object sender, System.ComponentModel.Prop
4660
}
4761
}
4862

49-
5063

5164
private void UnitPrice_TextChanged(object sender, TextChangedEventArgs e)
5265
{

0 commit comments

Comments
 (0)