POS-32 Dodano ekran personalizacji projektu

This commit is contained in:
Wojciech Przybyła 2020-12-21 15:29:38 +01:00
parent 48a742651a
commit a83d141ac2
7 changed files with 894 additions and 692 deletions

View File

@ -22,6 +22,7 @@ namespace Klient.Droid
public static int PickImageId = 1000;
private static readonly HttpClient client = new HttpClient();
public static Android.Content.Intent photo;
public string savedLogin = "";
protected override void OnCreate(Bundle savedInstanceState)
{
@ -58,7 +59,11 @@ namespace Klient.Droid
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/SignIn", content);
if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranPoLogowaniu);
if (response.StatusCode == HttpStatusCode.OK)
{
savedLogin = Login;
SetContentView(Resource.Layout.ekranPoLogowaniu);
}
}
[Java.Interop.Export("ResetPassword")]
@ -161,5 +166,38 @@ namespace Klient.Droid
}
}
[Java.Interop.Export("GoToProfil")]
public void GoToProfile(View v)
{
SetContentView(Resource.Layout.ekranProfil);
}
[Java.Interop.Export("Save")]
public async void SaveChanges(View v)
{
var Name = FindViewById<EditText>(Resource.Id.ChangeName).Text;
var Surname = FindViewById<EditText>(Resource.Id.ChangeSurname).Text;
var Email = FindViewById<EditText>(Resource.Id.ChangeEmail).Text;
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.ChangePassword).Text).SecurePassword;
var values = new Dictionary<string, string>
{
{ "email", Email },
{ "name", Name },
{ "surname", Surname },
{ "login", savedLogin },
{ "password", new NetworkCredential("", Password).Password }
};
var content = new FormUrlEncodedContent(values);
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);
}
}
}

View File

@ -137,6 +137,14 @@
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\Obraz3.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\ekranProfil.xml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

View File

@ -52,4 +52,25 @@
android:layout_alignParentRight="true"
android:layout_marginRight="75dp"
android:onClick="LoadFromCamera" />
<Button
android:text="?"
android:layout_width="35.0dp"
android:layout_height="35.0dp"
android:id="@+id/helpRegister"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="HelpRegisterScreen" />
<ImageButton
android:src="@drawable/obraz3"
android:layout_width="63.5dp"
android:layout_height="70.5dp"
android:background="#ffbdd7f0"
android:id="@+id/Profile"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:onClick="GoToProfil"/>
</RelativeLayout>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffbdd7f0">
<android.support.design.widget.TextInputLayout
android:id="@+id/LayoutNameC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:hint="Imie"
android:layout_alignParentLeft="true">
<android.support.design.widget.TextInputEditText
android:layout_width="204.0dp"
android:layout_height="58.0dp"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/ChangeName"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:capitalize="words"
android:textColorHint="#ff6c6767"
android:textColor="#ff000000"
android:inputType="none|textPersonName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/LayoutSurnameC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:hint="Nazwisko"
android:layout_below="@id/LayoutNameC"
android:layout_alignParentLeft="true">
<android.support.design.widget.TextInputEditText
android:layout_width="204.0dp"
android:layout_height="58.0dp"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/ChangeSurname"
android:textColorHint="#ff6c6767"
android:textColor="#ff000000"
android:inputType="none|textPersonName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/LayoutEmailC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:hint="Adres email"
android:layout_below="@id/LayoutSurnameC"
android:layout_alignParentLeft="true">
<android.support.design.widget.TextInputEditText
android:layout_width="204.0dp"
android:layout_height="58.0dp"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/ChangeEmail"
android:textColorHint="#ff6c6767"
android:textColor="#ff000000"
android:inputType="none|textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/LayoutNewPasswordC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@android:color/darker_gray"
android:layout_centerHorizontal="true"
android:hint="Hasło"
android:layout_below="@id/LayoutEmailC"
android:layout_alignParentLeft="true">
<android.support.design.widget.TextInputEditText
android:layout_width="204.0dp"
android:layout_height="58.0dp"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/ChangePassword"
android:inputType="none|textPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:text="Zapisz"
android:layout_width="100.5dp"
android:layout_height="50dp"
android:id="@+id/Save"
android:layout_below="@id/LayoutNewPasswordC"
android:layout_centerHorizontal="true"
android:foregroundGravity="center"
android:gravity="center"
android:onClick="Save"/>
</RelativeLayout>

View File

@ -146,12 +146,12 @@
android:text="?"
android:layout_width="35.0dp"
android:layout_height="35.0dp"
android:id="@+id/help"
android:id="@+id/helpRegister"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="HelpLoginScreen" />
android:onClick="HelpRegisterScreen" />
</RelativeLayout>