public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); var buttonToggleGrp = view.FindViewById <MaterialButtonToggleGroup>(Resource.Id.acc_type_opt_tglgrp); buttonToggleGrp.AddOnButtonCheckedListener(new ButtonCheckedListener((group, id, isChecked) => { switch (id) { case Resource.Id.client_btn: isDesigner = false; break; case Resource.Id.designer_btn: isDesigner = true; break; default: break; } })); var nextBtn = view.FindViewById <MaterialButton>(Resource.Id.acc_type_nxt_btn); nextBtn.Click += (s1, e1) => { editor = preferences.Edit(); editor.PutString("firstRun", "regd"); editor.Commit(); GetSmsFragment.SetStatus("done"); var i = new Intent(Context, typeof(MainActivity)); StartActivity(i); }; }
private async void SaveToDb() { try { var profileRef = SessionManager.GetFireDB().GetReference($"users/{SessionManager.UserId}/profile"); var userMap = new HashMap(); var stream = new System.IO.MemoryStream(); var bitmap = MediaStore.Images.Media.GetBitmap(Context.ContentResolver, img_uri); await bitmap.CompressAsync(Bitmap.CompressFormat.Webp, 90, stream); var imgArray = stream.ToArray(); var imageRef = FirebaseStorage.Instance.GetReference($"profileImages/{SessionManager.UserId}"); imageRef.PutBytes(imgArray).ContinueWithTask(new ContinuationTask( then: t => { if (!t.IsSuccessful) { throw t.Exception; } })).AddOnCompleteListener(new OncompleteListener( onComplete: t => { if (!t.IsSuccessful) { throw t.Exception; } userMap.Put(Constants.SNAPSHOT_FNAME, fullnameEt.EditText.Text); userMap.Put(Constants.SNAPSHOT_EMAIL, emailEt.EditText.Text); userMap.Put(Constants.SNAPSHOT_GENDER, (int)userGender); userMap.Put(Constants.SNAPSHOT_PHONE, SessionManager.GetFirebaseAuth().CurrentUser.PhoneNumber); userMap.Put(Constants.SNAPSHOT_PHOTO_URL, t.Result.ToString()); profileRef.SetValue(userMap).AddOnCompleteListener(new OncompleteListener( onComplete: task => { try { if (!task.IsSuccessful) { throw task.Exception; } GetSmsFragment.SetStatus("set_partner"); ParentFragmentManager.BeginTransaction() .Replace(Resource.Id.frag_container, new PartnerFragment()) .CommitAllowingStateLoss(); } catch (DatabaseException de) { OnboardingActivity.ShowError("Database Exception", de.Message); } })); profileRef.KeepSynced(true); })); } catch (DatabaseException fde) { OnboardingActivity.ShowError("Database Exception", fde.Message); } catch (FirebaseNetworkException) { OnboardingActivity.ShowNoNetDialog(false); } catch (StorageException se) { OnboardingActivity.ShowError("Storage Exception", se.Message); } catch (Exception ex) { OnboardingActivity.ShowError("Exception", ex.Message); } }