From 2ea2a4293f57299f9585732438f246db7410bbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przyby=C5=82a?= Date: Mon, 21 Dec 2020 16:19:54 +0100 Subject: [PATCH] POS-32 Dodano ekran edycji profilu --- Klient/Klient/Klient.Android/MainActivity.cs | 44 ++++++++-------- .../Klient/Klient.Android/Poszukiwacz.csproj | 3 ++ .../Resources/Resource.designer.cs | 50 +++++++++---------- .../Resources/layout/ekranPoZdjeciu.xml | 18 +++++-- .../Resources/layout/ekranProfil.xml | 29 ++++------- 5 files changed, 74 insertions(+), 70 deletions(-) diff --git a/Klient/Klient/Klient.Android/MainActivity.cs b/Klient/Klient/Klient.Android/MainActivity.cs index 85f507c..e25828f 100644 --- a/Klient/Klient/Klient.Android/MainActivity.cs +++ b/Klient/Klient/Klient.Android/MainActivity.cs @@ -13,6 +13,7 @@ using System.Security; using System.Net; using System.Linq; using System.IO; +using Newtonsoft.Json; namespace Klient.Droid { @@ -23,6 +24,9 @@ namespace Klient.Droid private static readonly HttpClient client = new HttpClient(); public static Android.Content.Intent photo; public string savedLogin = ""; + public string savedName = ""; + public string savedSurname = ""; + public string savedEmail = ""; protected override void OnCreate(Bundle savedInstanceState) { @@ -34,7 +38,7 @@ namespace Klient.Droid } [Java.Interop.Export("SignIn")] - async public void SignIn(View v) + async public void SignIn(Android.Views.View v) { var Login = FindViewById(Resource.Id.Login).Text; SecureString Password = new NetworkCredential("", FindViewById(Resource.Id.Password).Text).SecurePassword; @@ -66,12 +70,6 @@ namespace Klient.Droid } } - [Java.Interop.Export("ResetPassword")] - async public void ResetPassword() - { - SetContentView(Resource.Layout.ekranLogowania); - } - [Java.Interop.Export("SignUp")] async public void SignUp(View v) { @@ -178,26 +176,28 @@ namespace Klient.Droid var Name = FindViewById(Resource.Id.ChangeName).Text; var Surname = FindViewById(Resource.Id.ChangeSurname).Text; var Email = FindViewById(Resource.Id.ChangeEmail).Text; - SecureString Password = new NetworkCredential("", FindViewById(Resource.Id.ChangePassword).Text).SecurePassword; - - var values = new Dictionary + if (string.IsNullOrEmpty(Name) | string.IsNullOrEmpty(Email) | string.IsNullOrEmpty(Surname)) { - { "email", Email }, - { "name", Name }, - { "surname", Surname }, - { "login", savedLogin }, - { "password", new NetworkCredential("", Password).Password } - }; + FindViewById(Resource.Id.NullValueProfile).Text = "Wartości nie mogą być puste!"; + } + else + { + var values = new Dictionary + { + { "email", Email }, + { "name", Name }, + { "surname", Surname }, + { "login", savedLogin } + }; + var content = new FormUrlEncodedContent(values); + var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Update", content); - var content = new FormUrlEncodedContent(values); + var responseString = await response.Content.ReadAsStringAsync(); - var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Update", content); - - var responseString = await response.Content.ReadAsStringAsync(); - - if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranPoLogowaniu); + if (response.StatusCode == HttpStatusCode.OK) FindViewById(Resource.Id.NullValueProfile).Text = "Zapisano!"; + } } } } \ No newline at end of file diff --git a/Klient/Klient/Klient.Android/Poszukiwacz.csproj b/Klient/Klient/Klient.Android/Poszukiwacz.csproj index a2d8821..64896ce 100644 --- a/Klient/Klient/Klient.Android/Poszukiwacz.csproj +++ b/Klient/Klient/Klient.Android/Poszukiwacz.csproj @@ -57,6 +57,9 @@ + + 12.0.3 + 1.5.3.2 diff --git a/Klient/Klient/Klient.Android/Resources/Resource.designer.cs b/Klient/Klient/Klient.Android/Resources/Resource.designer.cs index c2a6d32..a0d3c60 100644 --- a/Klient/Klient/Klient.Android/Resources/Resource.designer.cs +++ b/Klient/Klient/Klient.Android/Resources/Resource.designer.cs @@ -9193,10 +9193,7 @@ namespace Klient.Droid public const int ChangeName = 2131230723; // aapt resource value: 0x7F080004 - public const int ChangePassword = 2131230724; - - // aapt resource value: 0x7F080005 - public const int ChangeSurname = 2131230725; + public const int ChangeSurname = 2131230724; // aapt resource value: 0x7F080052 public const int checkbox = 2131230802; @@ -9261,8 +9258,8 @@ namespace Klient.Droid // aapt resource value: 0x7F080065 public const int edit_query = 2131230821; - // aapt resource value: 0x7F080006 - public const int Email = 2131230726; + // aapt resource value: 0x7F080005 + public const int Email = 2131230725; // aapt resource value: 0x7F080066 public const int end = 2131230822; @@ -9276,6 +9273,9 @@ namespace Klient.Droid // aapt resource value: 0x7F080069 public const int enterAlwaysCollapsed = 2131230825; + // aapt resource value: 0x7F080006 + public const int ErrorPhoto = 2131230726; + // aapt resource value: 0x7F08006A public const int exitUntilCollapsed = 2131230826; @@ -9385,16 +9385,13 @@ namespace Klient.Droid public const int LayoutNewPassword2 = 2131230736; // aapt resource value: 0x7F080011 - public const int LayoutNewPasswordC = 2131230737; + public const int LayoutPassword = 2131230737; // aapt resource value: 0x7F080012 - public const int LayoutPassword = 2131230738; + public const int LayoutSurname = 2131230738; // aapt resource value: 0x7F080013 - public const int LayoutSurname = 2131230739; - - // aapt resource value: 0x7F080014 - public const int LayoutSurnameC = 2131230740; + public const int LayoutSurnameC = 2131230739; // aapt resource value: 0x7F080084 public const int left = 2131230852; @@ -9411,14 +9408,14 @@ namespace Klient.Droid // aapt resource value: 0x7F080088 public const int list_item = 2131230856; + // aapt resource value: 0x7F080014 + public const int LoadFromCamera = 2131230740; + // aapt resource value: 0x7F080015 - public const int LoadFromCamera = 2131230741; + public const int LoadFromFolder = 2131230741; // aapt resource value: 0x7F080016 - public const int LoadFromFolder = 2131230742; - - // aapt resource value: 0x7F080017 - public const int Login = 2131230743; + public const int Login = 2131230742; // aapt resource value: 0x7F080089 public const int main_appbar = 2131230857; @@ -9441,8 +9438,8 @@ namespace Klient.Droid // aapt resource value: 0x7F08008F public const int message = 2131230863; - // aapt resource value: 0x7F080018 - public const int META = 2131230744; + // aapt resource value: 0x7F080017 + public const int META = 2131230743; // aapt resource value: 0x7F080090 public const int middle = 2131230864; @@ -9597,8 +9594,8 @@ namespace Klient.Droid // aapt resource value: 0x7F0800C2 public const int multiply = 2131230914; - // aapt resource value: 0x7F080019 - public const int Name = 2131230745; + // aapt resource value: 0x7F080018 + public const int Name = 2131230744; // aapt resource value: 0x7F0800C3 public const int navigation_header_container = 2131230915; @@ -9606,11 +9603,11 @@ namespace Klient.Droid // aapt resource value: 0x7F0800C4 public const int never = 2131230916; - // aapt resource value: 0x7F08001A - public const int NewLogin = 2131230746; + // aapt resource value: 0x7F080019 + public const int NewLogin = 2131230745; - // aapt resource value: 0x7F08001B - public const int NewPassword = 2131230747; + // aapt resource value: 0x7F08001A + public const int NewPassword = 2131230746; // aapt resource value: 0x7F0800C5 public const int none = 2131230917; @@ -9627,6 +9624,9 @@ namespace Klient.Droid // aapt resource value: 0x7F0800C9 public const int notification_main_column_container = 2131230921; + // aapt resource value: 0x7F08001B + public const int NullValueProfile = 2131230747; + // aapt resource value: 0x7F0800CA public const int outline = 2131230922; diff --git a/Klient/Klient/Klient.Android/Resources/layout/ekranPoZdjeciu.xml b/Klient/Klient/Klient.Android/Resources/layout/ekranPoZdjeciu.xml index 9fa1526..19bd960 100644 --- a/Klient/Klient/Klient.Android/Resources/layout/ekranPoZdjeciu.xml +++ b/Klient/Klient/Klient.Android/Resources/layout/ekranPoZdjeciu.xml @@ -1,5 +1,5 @@ - + android:id="@+id/SendPhoto" + android:onClick="SendPhoto" + android:layout_below="@id/Preview" /> + - + diff --git a/Klient/Klient/Klient.Android/Resources/layout/ekranProfil.xml b/Klient/Klient/Klient.Android/Resources/layout/ekranProfil.xml index e9a0994..5081c6f 100644 --- a/Klient/Klient/Klient.Android/Resources/layout/ekranProfil.xml +++ b/Klient/Klient/Klient.Android/Resources/layout/ekranProfil.xml @@ -63,34 +63,25 @@ android:textColorHint="#ff6c6767" android:textColor="#ff000000" android:inputType="none|textEmailAddress" /> - - -