コード例 #1
0
        private void InitControls()
        {
            //Terms and conditions
            var             termsText = (TextView)FindViewById(Resource.Id.terms_tv);
            string          first     = "By signing up you agree to our ";
            string          last      = "Terms and Conditions";
            SpannableString str       = new SpannableString(first + last);

            str.SetSpan(new StyleSpan(TypefaceStyle.Bold), first.Length, first.Length + last.Length, SpanTypes.ExclusiveExclusive);
            termsText.TextFormatted = str;

            //email
            EmailEditText = (TextInputEditText)FindViewById(Resource.Id.email_edittext);
            EmailEditText.SetOnKeyListener(this);
            EmailEditText.AddTextChangedListener(this);

            //firstname
            FirstNameEditText = (TextInputEditText)FindViewById(Resource.Id.fname_edittext);
            FirstNameEditText.SetOnKeyListener(this);
            FirstNameEditText.AddTextChangedListener(this);

            //lastname
            LastNameEditText = (TextInputEditText)FindViewById(Resource.Id.lname_edittext);
            LastNameEditText.SetOnKeyListener(this);
            LastNameEditText.AddTextChangedListener(this);
            ProfileNextBtn        = (Button)FindViewById(Resource.Id.profile_prim_btn);
            ProfileNextBtn.Click += (s1, e1) =>
            {
                var email     = EmailEditText.Text.Trim();
                var firstname = FirstNameEditText.Text.Trim();
                var lastname  = LastNameEditText.Text.Trim();
                var isLinked  = false;

                HashMap userMap = new HashMap();
                userMap.Put("email", email);
                userMap.Put("phone", userPhone);
                userMap.Put("firstname", firstname);
                userMap.Put("lastname", lastname);
                userMap.Put("isLinkedWithAuth", isLinked);
                userMap.Put("timestamp", DateTime.UtcNow.ToString());

                DatabaseReference userReference = database.GetReference("Taxify_users/" + mAuth.CurrentUser.Uid).Child("User_profile");
                userReference.SetValue(userMap);
                userReference.KeepSynced(true);

                SaveToSharedPreference(email, userPhone, firstname, lastname, isLinked);
                hideKeyboard = new HideKeyboardHelper(this);

                var intent = new Intent(this, typeof(MainActivity));

                intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.ClearTask | ActivityFlags.NewTask);
                StartActivity(intent);
                OverridePendingTransition(Resource.Animation.slide_up_anim, Resource.Animation.slide_up_out);
                Finish();
            };
        }