Exemple #1
0
        private void PrepareGoogleSignIn()
        {
            GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                                      .RequestEmail()
                                      .Build();

            _googleApiClient = new GoogleApiClient.Builder(this)
                               .EnableAutoManage(this, new GoogleConnectionFailedCallback()
            {
                Activity = this
            })
                               .AddApi(Auth.GOOGLE_SIGN_IN_API, gso)
                               .Build();

            googleSignInButton = FindViewById <SignInButton>(Resource.Id.signIn_GoogleSignInButton);

            for (int i = 0; i < googleSignInButton.ChildCount; i++)
            {
                View v = googleSignInButton.GetChildAt(i);

                if (v is TextView tv)
                {
                    tv.SetPadding(0, 0, 20, 0);
                    return;
                }
            }
        }
Exemple #2
0
        protected void SetGoogleSingInButtonText(SignInButton signInButton, String buttonText)
        {
            // Find the TextView that is inside of the SignInButton and set its text
            for (int i = 0; i < signInButton.ChildCount; i++)
            {
                View v = signInButton.GetChildAt(i);

                if (v is TextView)
                {
                    TextView tv = (TextView)v;
                    tv.Text = buttonText;
                    return;
                }
            }
        }