Skip to content

Commit 81c950d

Browse files
authored
Merge pull request #11 from codeficct/development
Add TextColor in Labels and Buttons
2 parents 016453a + 3091826 commit 81c950d

18 files changed

Lines changed: 230 additions & 158 deletions

MatchingGame.Android/MatchingGame.Android.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<ErrorReport>prompt</ErrorReport>
3434
<WarningLevel>4</WarningLevel>
3535
<AndroidLinkMode>None</AndroidLinkMode>
36+
<AotAssemblies>false</AotAssemblies>
37+
<EnableLLVM>false</EnableLLVM>
38+
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
39+
<BundleAssemblies>false</BundleAssemblies>
3640
</PropertyGroup>
3741
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3842
<DebugSymbols>true</DebugSymbols>

MatchingGame.Android/Resources/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<item name="colorPrimaryDark">#140429</item>
77
<item name="colorAccent">#fe207d</item>
88
<item name="android:windowBackground">@drawable/splashpresentation</item>
9-
<item name="android:windowIsTranslucent">true</item>
9+
<!--<item name="android:windowIsTranslucent">true</item>-->
1010
<item name="android:windowAnimationStyle">@style/MyTheme.Splash</item>
1111
<item name="android:windowNoTitle">true</item>
1212
<item name="android:windowContentOverlay">@null</item>

MatchingGame/Vistas/GamePage/Game.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<Label
2424
Text="Nivel"
2525
FontSize="16"
26+
TextColor="#ccc"
2627
HorizontalOptions="Center" />
2728
</StackLayout>
2829
</Frame>
@@ -50,6 +51,7 @@
5051
<Button
5152
Text="Info"
5253
CornerRadius="24"
54+
TextColor="White"
5355
FontSize="18"
5456
FontAttributes="Bold"
5557
BackgroundColor="#a95aad"
@@ -61,6 +63,7 @@
6163
<Button
6264
Grid.Column="1"
6365
Text="Jugar"
66+
TextColor="White"
6467
CornerRadius="24"
6568
Margin="10,0"
6669
FontSize="18"
@@ -80,6 +83,7 @@
8083
<Button
8184
Grid.Column="2"
8285
Text="Salir"
86+
TextColor="White"
8387
CornerRadius="24"
8488
FontSize="18"
8589
FontAttributes="Bold"

MatchingGame/Vistas/GamePage/Game.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Game(int level, int Score)
4646

4747
private async void btnClose_Clicked(object sender, EventArgs e)
4848
{
49-
await Navigation.PopToRootAsync();
49+
await Navigation.PushAsync(new Home());
5050
}
5151

5252
private async void playGame_Clicked(object sender, EventArgs e)

MatchingGame/Vistas/HomePage/Home.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Grid RowDefinitions="30" ColumnDefinitions="*,*">
1414
<StackLayout Grid.Column="0" Orientation="Horizontal" HorizontalOptions="Start">
1515
<Frame Padding="42,4,14,4" TranslationX="-30" WidthRequest="50" BackgroundColor="#411645" HeightRequest="30" CornerRadius="14">
16-
<Label Text="0" HorizontalOptions="Center" FontAttributes="Bold" FontSize="16" x:Name="lblScore" VerticalOptions="Center" />
16+
<Label TextColor="White" Text="0" HorizontalOptions="Center" FontAttributes="Bold" FontSize="16" x:Name="lblScore" VerticalOptions="Center" />
1717
</Frame>
1818
<Image Source="star" HeightRequest="30" HorizontalOptions="Start" TranslationX="-50" TranslationY="-2" Rotation="-10"/>
1919
</StackLayout>

MatchingGame/Vistas/HomePage/Home.xaml.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public Home()
3636
if (Application.Current.Properties.ContainsKey("Token")
3737
&& Application.Current.Properties.ContainsKey("Name"))
3838
{
39+
GetUserLoggedIn(Application.Current.Properties["Id"].ToString());
3940
UserName.Text = Application.Current.Properties["Name"].ToString();
4041
Register.Text = "Ver Perfil";
4142
}
@@ -50,6 +51,31 @@ public Home()
5051
GetVersionApp();
5152
}
5253

54+
public async void GetUserLoggedIn(string id)
55+
{
56+
try
57+
{
58+
Uri RequestUri = new($"https://matchinggame.vercel.app/api/matching-game/{id}");
59+
var client = new HttpClient();
60+
HttpResponseMessage response = await client.GetAsync(RequestUri);
61+
if (response.IsSuccessStatusCode)
62+
{
63+
var content = await response.Content.ReadAsStringAsync();
64+
User user = JsonConvert.DeserializeObject<User>(content);
65+
Application.Current.Properties["Name"] = user.name;
66+
Application.Current.Properties["Photo"] = user.photo;
67+
Application.Current.Properties["Email"] = user.email;
68+
Application.Current.Properties["Score"] = user.score;
69+
lblScore.Text = user.score.ToString();
70+
Application.Current.Properties["MaxLevel"] = user.maxLevel;
71+
}
72+
}
73+
catch (Exception)
74+
{
75+
(Application.Current).MainPage = new NavigationPage(new Home());
76+
}
77+
}
78+
5379
public async void GetVersionApp()
5480
{
5581
try
@@ -74,9 +100,9 @@ public async void GetVersionApp()
74100
}
75101
}
76102
}
77-
catch (Exception error)
103+
catch (Exception)
78104
{
79-
await DisplayAlert("Error", error.Message, "Cancelar");
105+
(Application.Current).MainPage = new NavigationPage(new Home());
80106
}
81107
}
82108

@@ -89,7 +115,7 @@ private async void Register_Clicked(object sender, EventArgs e)
89115
{
90116
if (Application.Current.Properties.ContainsKey("Token")
91117
&& Application.Current.Properties.ContainsKey("Name"))
92-
await Navigation.PushAsync(new ProfilePage());
118+
await Navigation.PushModalAsync(new ProfilePage());
93119
else
94120
await Navigation.PushAsync(new RegisterPage());
95121
}
@@ -98,26 +124,11 @@ protected override bool OnBackButtonPressed()
98124
{
99125
base.OnBackButtonPressed();
100126
var existingPages = Navigation.NavigationStack.ToList();
101-
102127
foreach (var page in existingPages)
103-
{
104-
if (existingPages[0] != page)
105-
{
128+
if (existingPages[existingPages.Count - 1] != page)
106129
Navigation.RemovePage(page);
107-
}
108-
}
109-
//Device.BeginInvokeOnMainThread(async () =>
110-
//{
111-
// var result = await DisplayAlert("Salir", "¿Desea salir de la aplicación?", "Si", "No");
112-
// if (result) await Navigation.PopAsync();
113-
//});
114-
return false;
115-
}
116130

117-
private void PromptForExit()
118-
{
119-
Application.Current.Quit();
120-
// System.Environment.Exit(0);
131+
return false;
121132
}
122133

123134
private async void NavigateToInfoPage_Clicked(object sender, EventArgs e)

MatchingGame/Vistas/LoginPage/AvatarsPage.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
x:Class="MatchingGame.Vistas.LoginPage.AvatarsPage"
55
NavigationPage.HasNavigationBar="False">
66
<ContentPage.Content>
7-
<Grid RowDefinitions="*,60" BackgroundColor="#140429">
7+
<Grid RowDefinitions="*,70" BackgroundColor="#140429">
88
<ScrollView Grid.Row="0">
99
<StackLayout HorizontalOptions="CenterAndExpand" Padding="30,0,30,30">
1010
<Label Text="Selecciona tu avatar" FontSize="Large" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" Margin="0,30,0,10" />
@@ -14,10 +14,12 @@
1414
<StackLayout Grid.Row="1">
1515
<Button
1616
Text="Continuar"
17+
TextColor="White"
1718
FontSize="22"
19+
VerticalOptions="Center"
1820
FontAttributes="Bold"
1921
CornerRadius="24"
20-
Margin="70,0"
22+
Margin="70,5"
2123
HeightRequest="54"
2224
BackgroundColor="#fe207d"
2325
BorderColor="#411645"

MatchingGame/Vistas/LoginPage/LoginPage.xaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
Padding="20,0"
2727
Margin="0">
2828
<StackLayout Orientation="Horizontal">
29-
<Label Text="📧" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
29+
<Label Text="📧" TextColor="White" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
3030
<Entry
3131
x:Name="BoxEmail"
32+
TextColor="White"
33+
PlaceholderColor="#ccc"
3234
Keyboard="Email"
3335
Placeholder="example@example.com"
3436
HorizontalOptions="FillAndExpand"/>
@@ -41,9 +43,11 @@
4143
Padding="20,0"
4244
Margin="0">
4345
<StackLayout Orientation="Horizontal">
44-
<Label Text="🔒" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
46+
<Label Text="🔒" TextColor="White" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
4547
<Entry
4648
x:Name="BoxPassword"
49+
TextColor="White"
50+
PlaceholderColor="#ccc"
4751
IsPassword="True"
4852
Placeholder="Contraseña"
4953
HorizontalOptions="FillAndExpand"/>
@@ -56,6 +60,7 @@
5660
Text="Iniciar Sesión"
5761
x:Name="Login"
5862
Clicked="Login_Clicked"
63+
TextColor="White"
5964
FontSize="22"
6065
FontAttributes="Bold"
6166
CornerRadius="24"
@@ -65,12 +70,13 @@
6570
BorderColor="#411645"
6671
BorderWidth="4"/>
6772
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" Margin="0,10,0,0">
68-
<Label Text="¿No tienes una cuenta?" FontSize="16" VerticalOptions="Center" TranslationX="5" />
73+
<Label Text="¿No tienes una cuenta?" TextColor="#ccc" FontSize="16" VerticalOptions="Center" TranslationX="5" />
6974
<Button
7075
Text="Registrate"
7176
BackgroundColor="Transparent"
7277
x:Name="Register"
7378
TranslationX="-7"
79+
TextColor="White"
7480
FontSize="16"
7581
HeightRequest="42"
7682
TextTransform="None"

MatchingGame/Vistas/LoginPage/LoginPage.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ private async void Login_Clicked(object sender, EventArgs e)
7171
Application.Current.Properties["Password"] = results.password;
7272
Application.Current.Properties["Token"] = results.token;
7373
Application.Current.Properties["MaxLevel"] = results.maxLevel;
74-
75-
await Navigation.PushAsync(new Home());
74+
(Application.Current).MainPage = new NavigationPage(new Home());
7675
}
7776
else if (response.StatusCode == HttpStatusCode.BadRequest)
7877
{

MatchingGame/Vistas/LoginPage/RegisterPage.xaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
Padding="20,0"
2929
Margin="0">
3030
<StackLayout Orientation="Horizontal">
31-
<Label Text="👤" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
31+
<Label Text="👤" TextColor="White" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
3232
<Entry
3333
x:Name="BoxName"
3434
Keyboard="Text"
35+
TextColor="White"
36+
PlaceholderColor="#ccc"
3537
Margin="0"
3638
Placeholder="Introduzca su nombre"
3739
IsTextPredictionEnabled="True"
@@ -45,10 +47,13 @@
4547
Padding="20,0"
4648
Margin="0">
4749
<StackLayout Orientation="Horizontal">
48-
<Label Text="📧" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
50+
<Label Text="📧" TextColor="White"
51+
VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
4952
<Entry
5053
x:Name="BoxEmail"
5154
Keyboard="Email"
55+
TextColor="White"
56+
PlaceholderColor="#ccc"
5257
Placeholder="example@example.com"
5358
HorizontalOptions="FillAndExpand"/>
5459
</StackLayout>
@@ -60,11 +65,13 @@
6065
Padding="20,0"
6166
Margin="0">
6267
<StackLayout Orientation="Horizontal">
63-
<Label Text="🔒" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
68+
<Label Text="🔒" TextColor="White" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
6469
<Entry
6570
x:Name="BoxPassword"
6671
IsPassword="True"
6772
Placeholder="Contraseña"
73+
TextColor="White"
74+
PlaceholderColor="#ccc"
6875
HorizontalOptions="FillAndExpand"/>
6976
</StackLayout>
7077
</Frame>
@@ -76,10 +83,12 @@
7683
Margin="0"
7784
>
7885
<StackLayout Orientation="Horizontal">
79-
<Label Text="🔒" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
86+
<Label Text="🔒" TextColor="White" VerticalOptions="Center" FontSize="20" Padding="0,0,0,3" WidthRequest="23" />
8087
<Entry
8188
x:Name="BoxPasswordRepeat"
8289
IsPassword="True"
90+
TextColor="White"
91+
PlaceholderColor="#ccc"
8392
TextChanged="BoxPasswordRepeat_TextChanged"
8493
Placeholder="Contraseña de nuevo"
8594
HorizontalOptions="FillAndExpand"/>
@@ -95,6 +104,7 @@
95104
CornerRadius="24"
96105
Margin="70,0"
97106
HeightRequest="54"
107+
TextColor="White"
98108
BackgroundColor="#fe207d"
99109
BorderColor="#411645"
100110
BorderWidth="4"
@@ -104,6 +114,7 @@
104114
Text="Iniciar Sesión"
105115
HorizontalOptions="Center"
106116
BackgroundColor="Transparent"
117+
TextColor="White"
107118
x:Name="LogIn"
108119
FontSize="16"
109120
TextTransform="Lowercase"

0 commit comments

Comments
 (0)