POS-22 Stworzono możliwość dodawania zdjęcia z galerii.

This commit is contained in:
Wojciech Przybyła 2020-12-13 18:58:31 +01:00
parent b1b934ca9b
commit 827b522c65
3 changed files with 183 additions and 173 deletions

View File

@ -18,11 +18,12 @@ namespace Klient.Droid
[Activity(Label = "Klient", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
public static int PickImageId = 1000;
private static readonly HttpClient client = new HttpClient();
protected override void OnCreate(Bundle savedInstanceState)
{
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
@ -40,7 +41,7 @@ namespace Klient.Droid
{
SetContentView(Resource.Layout.ekranLogowania);
}
if(string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
{
SetContentView(Resource.Layout.ekranLogowania);
}
@ -56,13 +57,13 @@ namespace Klient.Droid
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/SignIn", content);
if (response.StatusCode == HttpStatusCode.InternalServerError) SetContentView(Resource.Layout.ekranPoLogowaniu);
if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranPoLogowaniu);
}
[Java.Interop.Export("ResetPassword")]
async public void ResetPassword()
{
SetContentView(Resource.Layout.ekranLogowania);
}
[Java.Interop.Export("SignUp")]
@ -75,7 +76,7 @@ namespace Klient.Droid
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword;
SecureString Password2 = new NetworkCredential("", FindViewById<EditText>(Resource.Id.RepeatPassword).Text).SecurePassword;
if(new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password)
if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password)
{
SetContentView(Resource.Layout.ekranRejestracji);
}
@ -95,7 +96,7 @@ namespace Klient.Droid
var responseString = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode) SetContentView(Resource.Layout.ekranLogowania);
if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranLogowania);
}
[Java.Interop.Export("HelpLoginScreen")]
@ -119,13 +120,25 @@ namespace Klient.Droid
[Java.Interop.Export("about")]
public void MainScreenAbout(View v)
{
SetContentView(Resource.Layout.ekranStartowy);
}
[Java.Interop.Export("LoadFromCamera")]
async public void TakePhoto(View v)
[Java.Interop.Export("LoadFromFolder")]
public void LoadFile(View v)
{
Intent = new Android.Content.Intent();
Intent.SetType("image/*");
Intent.SetAction(Android.Content.Intent.ActionGetContent);
StartActivityForResult(Android.Content.Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
{
SetContentView(Resource.Layout.ekranPoZdjeciu);
Android.Net.Uri uri = data.Data;
FindViewById<ImageView>(Resource.Id.Preview).SetImageURI(uri);
}
}
}

View File

@ -9054,278 +9054,275 @@ namespace Klient.Droid
public partial class Id
{
// aapt resource value: 0x7F080019
public const int about = 2131230745;
// aapt resource value: 0x7F08001A
public const int action0 = 2131230746;
// aapt resource value: 0x7F08002C
public const int actions = 2131230764;
public const int about = 2131230746;
// aapt resource value: 0x7F08001B
public const int action_bar = 2131230747;
// aapt resource value: 0x7F08001C
public const int action_bar_activity_content = 2131230748;
// aapt resource value: 0x7F08001D
public const int action_bar_container = 2131230749;
// aapt resource value: 0x7F08001E
public const int action_bar_root = 2131230750;
// aapt resource value: 0x7F08001F
public const int action_bar_spinner = 2131230751;
// aapt resource value: 0x7F080020
public const int action_bar_subtitle = 2131230752;
// aapt resource value: 0x7F080021
public const int action_bar_title = 2131230753;
// aapt resource value: 0x7F080022
public const int action_container = 2131230754;
// aapt resource value: 0x7F080023
public const int action_context_bar = 2131230755;
// aapt resource value: 0x7F080024
public const int action_divider = 2131230756;
// aapt resource value: 0x7F080025
public const int action_image = 2131230757;
// aapt resource value: 0x7F080026
public const int action_menu_divider = 2131230758;
// aapt resource value: 0x7F080027
public const int action_menu_presenter = 2131230759;
// aapt resource value: 0x7F080028
public const int action_mode_bar = 2131230760;
// aapt resource value: 0x7F080029
public const int action_mode_bar_stub = 2131230761;
// aapt resource value: 0x7F08002A
public const int action_mode_close_button = 2131230762;
// aapt resource value: 0x7F08002B
public const int action_text = 2131230763;
public const int action0 = 2131230747;
// aapt resource value: 0x7F08002D
public const int activity_chooser_view_content = 2131230765;
public const int actions = 2131230765;
// aapt resource value: 0x7F08001C
public const int action_bar = 2131230748;
// aapt resource value: 0x7F08001D
public const int action_bar_activity_content = 2131230749;
// aapt resource value: 0x7F08001E
public const int action_bar_container = 2131230750;
// aapt resource value: 0x7F08001F
public const int action_bar_root = 2131230751;
// aapt resource value: 0x7F080020
public const int action_bar_spinner = 2131230752;
// aapt resource value: 0x7F080021
public const int action_bar_subtitle = 2131230753;
// aapt resource value: 0x7F080022
public const int action_bar_title = 2131230754;
// aapt resource value: 0x7F080023
public const int action_container = 2131230755;
// aapt resource value: 0x7F080024
public const int action_context_bar = 2131230756;
// aapt resource value: 0x7F080025
public const int action_divider = 2131230757;
// aapt resource value: 0x7F080026
public const int action_image = 2131230758;
// aapt resource value: 0x7F080027
public const int action_menu_divider = 2131230759;
// aapt resource value: 0x7F080028
public const int action_menu_presenter = 2131230760;
// aapt resource value: 0x7F080029
public const int action_mode_bar = 2131230761;
// aapt resource value: 0x7F08002A
public const int action_mode_bar_stub = 2131230762;
// aapt resource value: 0x7F08002B
public const int action_mode_close_button = 2131230763;
// aapt resource value: 0x7F08002C
public const int action_text = 2131230764;
// aapt resource value: 0x7F08002E
public const int add = 2131230766;
public const int activity_chooser_view_content = 2131230766;
// aapt resource value: 0x7F08002F
public const int alertTitle = 2131230767;
public const int add = 2131230767;
// aapt resource value: 0x7F080030
public const int all = 2131230768;
public const int alertTitle = 2131230768;
// aapt resource value: 0x7F080031
public const int all = 2131230769;
// aapt resource value: 0x7F080000
public const int ALT = 2131230720;
// aapt resource value: 0x7F080031
public const int always = 2131230769;
// aapt resource value: 0x7F080032
public const int async = 2131230770;
public const int always = 2131230770;
// aapt resource value: 0x7F080033
public const int auto = 2131230771;
public const int async = 2131230771;
// aapt resource value: 0x7F080034
public const int beginning = 2131230772;
public const int auto = 2131230772;
// aapt resource value: 0x7F080035
public const int blocking = 2131230773;
public const int beginning = 2131230773;
// aapt resource value: 0x7F080036
public const int bottom = 2131230774;
public const int blocking = 2131230774;
// aapt resource value: 0x7F080037
public const int bottomtab_navarea = 2131230775;
public const int bottom = 2131230775;
// aapt resource value: 0x7F080038
public const int bottomtab_tabbar = 2131230776;
public const int bottomtab_navarea = 2131230776;
// aapt resource value: 0x7F080039
public const int browser_actions_header_text = 2131230777;
// aapt resource value: 0x7F08003C
public const int browser_actions_menu_items = 2131230780;
public const int bottomtab_tabbar = 2131230777;
// aapt resource value: 0x7F08003A
public const int browser_actions_menu_item_icon = 2131230778;
// aapt resource value: 0x7F08003B
public const int browser_actions_menu_item_text = 2131230779;
public const int browser_actions_header_text = 2131230778;
// aapt resource value: 0x7F08003D
public const int browser_actions_menu_view = 2131230781;
public const int browser_actions_menu_items = 2131230781;
// aapt resource value: 0x7F08003B
public const int browser_actions_menu_item_icon = 2131230779;
// aapt resource value: 0x7F08003C
public const int browser_actions_menu_item_text = 2131230780;
// aapt resource value: 0x7F08003E
public const int buttonPanel = 2131230782;
public const int browser_actions_menu_view = 2131230782;
// aapt resource value: 0x7F08003F
public const int cancel_action = 2131230783;
public const int buttonPanel = 2131230783;
// aapt resource value: 0x7F080040
public const int center = 2131230784;
public const int cancel_action = 2131230784;
// aapt resource value: 0x7F080041
public const int center_horizontal = 2131230785;
public const int center = 2131230785;
// aapt resource value: 0x7F080042
public const int center_vertical = 2131230786;
public const int center_horizontal = 2131230786;
// aapt resource value: 0x7F080043
public const int checkbox = 2131230787;
public const int center_vertical = 2131230787;
// aapt resource value: 0x7F080044
public const int chronometer = 2131230788;
public const int checkbox = 2131230788;
// aapt resource value: 0x7F080045
public const int clip_horizontal = 2131230789;
public const int chronometer = 2131230789;
// aapt resource value: 0x7F080046
public const int clip_vertical = 2131230790;
public const int clip_horizontal = 2131230790;
// aapt resource value: 0x7F080047
public const int collapseActionView = 2131230791;
public const int clip_vertical = 2131230791;
// aapt resource value: 0x7F080048
public const int container = 2131230792;
public const int collapseActionView = 2131230792;
// aapt resource value: 0x7F080049
public const int content = 2131230793;
public const int container = 2131230793;
// aapt resource value: 0x7F08004A
public const int contentPanel = 2131230794;
public const int content = 2131230794;
// aapt resource value: 0x7F08004B
public const int coordinator = 2131230795;
public const int contentPanel = 2131230795;
// aapt resource value: 0x7F08004C
public const int coordinator = 2131230796;
// aapt resource value: 0x7F080001
public const int CTRL = 2131230721;
// aapt resource value: 0x7F08004C
public const int custom = 2131230796;
// aapt resource value: 0x7F08004D
public const int customPanel = 2131230797;
public const int custom = 2131230797;
// aapt resource value: 0x7F08004E
public const int decor_content_parent = 2131230798;
public const int customPanel = 2131230798;
// aapt resource value: 0x7F08004F
public const int default_activity_button = 2131230799;
public const int decor_content_parent = 2131230799;
// aapt resource value: 0x7F080050
public const int design_bottom_sheet = 2131230800;
public const int default_activity_button = 2131230800;
// aapt resource value: 0x7F080051
public const int design_menu_item_action_area = 2131230801;
public const int design_bottom_sheet = 2131230801;
// aapt resource value: 0x7F080052
public const int design_menu_item_action_area_stub = 2131230802;
public const int design_menu_item_action_area = 2131230802;
// aapt resource value: 0x7F080053
public const int design_menu_item_text = 2131230803;
public const int design_menu_item_action_area_stub = 2131230803;
// aapt resource value: 0x7F080054
public const int design_navigation_view = 2131230804;
public const int design_menu_item_text = 2131230804;
// aapt resource value: 0x7F080055
public const int disableHome = 2131230805;
public const int design_navigation_view = 2131230805;
// aapt resource value: 0x7F080056
public const int edit_query = 2131230806;
public const int disableHome = 2131230806;
// aapt resource value: 0x7F080057
public const int edit_query = 2131230807;
// aapt resource value: 0x7F080002
public const int Email = 2131230722;
// aapt resource value: 0x7F080057
public const int end = 2131230807;
// aapt resource value: 0x7F080058
public const int end_padder = 2131230808;
public const int end = 2131230808;
// aapt resource value: 0x7F080059
public const int enterAlways = 2131230809;
public const int end_padder = 2131230809;
// aapt resource value: 0x7F08005A
public const int enterAlwaysCollapsed = 2131230810;
public const int enterAlways = 2131230810;
// aapt resource value: 0x7F08005B
public const int exitUntilCollapsed = 2131230811;
// aapt resource value: 0x7F08005D
public const int expanded_menu = 2131230813;
public const int enterAlwaysCollapsed = 2131230811;
// aapt resource value: 0x7F08005C
public const int expand_activities_button = 2131230812;
public const int exitUntilCollapsed = 2131230812;
// aapt resource value: 0x7F08005E
public const int fill = 2131230814;
public const int expanded_menu = 2131230814;
// aapt resource value: 0x7F080061
public const int filled = 2131230817;
// aapt resource value: 0x7F08005D
public const int expand_activities_button = 2131230813;
// aapt resource value: 0x7F08005F
public const int fill_horizontal = 2131230815;
// aapt resource value: 0x7F080060
public const int fill_vertical = 2131230816;
public const int fill = 2131230815;
// aapt resource value: 0x7F080062
public const int @fixed = 2131230818;
public const int filled = 2131230818;
// aapt resource value: 0x7F080060
public const int fill_horizontal = 2131230816;
// aapt resource value: 0x7F080061
public const int fill_vertical = 2131230817;
// aapt resource value: 0x7F080063
public const int flyoutcontent_appbar = 2131230819;
public const int @fixed = 2131230819;
// aapt resource value: 0x7F080064
public const int flyoutcontent_recycler = 2131230820;
public const int flyoutcontent_appbar = 2131230820;
// aapt resource value: 0x7F080065
public const int forever = 2131230821;
public const int flyoutcontent_recycler = 2131230821;
// aapt resource value: 0x7F080066
public const int forever = 2131230822;
// aapt resource value: 0x7F080003
public const int FUNCTION = 2131230723;
// aapt resource value: 0x7F080066
public const int ghost_view = 2131230822;
// aapt resource value: 0x7F080067
public const int group_divider = 2131230823;
public const int ghost_view = 2131230823;
// aapt resource value: 0x7F080068
public const int help = 2131230824;
public const int group_divider = 2131230824;
// aapt resource value: 0x7F080069
public const int home = 2131230825;
public const int help = 2131230825;
// aapt resource value: 0x7F08006A
public const int homeAsUp = 2131230826;
public const int home = 2131230826;
// aapt resource value: 0x7F08006B
public const int icon = 2131230827;
public const int homeAsUp = 2131230827;
// aapt resource value: 0x7F08006C
public const int icon_group = 2131230828;
public const int icon = 2131230828;
// aapt resource value: 0x7F08006D
public const int ifRoom = 2131230829;
public const int icon_group = 2131230829;
// aapt resource value: 0x7F08006E
public const int image = 2131230830;
public const int ifRoom = 2131230830;
// aapt resource value: 0x7F08006F
public const int imageView1 = 2131230831;
public const int image = 2131230831;
// aapt resource value: 0x7F080004
public const int In = 2131230724;
@ -9603,6 +9600,9 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800BF
public const int pin = 2131230911;
// aapt resource value: 0x7F080010
public const int Preview = 2131230736;
// aapt resource value: 0x7F0800C0
public const int progress_circular = 2131230912;
@ -9612,11 +9612,11 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800C2
public const int radio = 2131230914;
// aapt resource value: 0x7F080010
public const int RepeatPassword = 2131230736;
// aapt resource value: 0x7F080011
public const int Reset = 2131230737;
public const int RepeatPassword = 2131230737;
// aapt resource value: 0x7F080012
public const int Reset = 2131230738;
// aapt resource value: 0x7F0800C3
public const int right = 2131230915;
@ -9690,8 +9690,8 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800D9
public const int select_dialog_listview = 2131230937;
// aapt resource value: 0x7F080014
public const int SendPhoto = 2131230740;
// aapt resource value: 0x7F080015
public const int SendPhoto = 2131230741;
// aapt resource value: 0x7F0800DB
public const int shellcontent_appbar = 2131230939;
@ -9699,8 +9699,8 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800DC
public const int shellcontent_toolbar = 2131230940;
// aapt resource value: 0x7F080012
public const int SHIFT = 2131230738;
// aapt resource value: 0x7F080013
public const int SHIFT = 2131230739;
// aapt resource value: 0x7F0800DD
public const int shortcut = 2131230941;
@ -9714,14 +9714,14 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800E0
public const int showTitle = 2131230944;
// aapt resource value: 0x7F080015
public const int SignInMainScreen = 2131230741;
// aapt resource value: 0x7F080016
public const int SignUp = 2131230742;
public const int SignInMainScreen = 2131230742;
// aapt resource value: 0x7F080017
public const int SignUpMainScreen = 2131230743;
public const int SignUp = 2131230743;
// aapt resource value: 0x7F080018
public const int SignUpMainScreen = 2131230744;
// aapt resource value: 0x7F0800E1
public const int smallLabel = 2131230945;
@ -9768,11 +9768,11 @@ namespace Klient.Droid
// aapt resource value: 0x7F0800EF
public const int submit_area = 2131230959;
// aapt resource value: 0x7F080018
public const int Surname = 2131230744;
// aapt resource value: 0x7F080019
public const int Surname = 2131230745;
// aapt resource value: 0x7F080013
public const int SYM = 2131230739;
// aapt resource value: 0x7F080014
public const int SYM = 2131230740;
// aapt resource value: 0x7F0800F0
public const int tabMode = 2131230960;
@ -15094,10 +15094,7 @@ namespace Klient.Droid
{
// aapt resource value: 0x7F100000
public const int network_security_config = 2131755008;
// aapt resource value: 0x7F100001
public const int xamarin_essentials_fileprovider_file_paths = 2131755009;
public const int xamarin_essentials_fileprovider_file_paths = 2131755008;
static Xml()
{

View File

@ -5,12 +5,12 @@
android:layout_height="match_parent"
android:background="#ffbdd7f0">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="217.5dp"
android:minWidth="100px"
android:minHeight="100px"
android:id="@+id/imageView1" />
android:id="@+id/Preview" />
<Button
android:text="Wyślij zdjęcie"
android:layout_width="match_parent"