Why screen gets dim for a while when when clicking Google Sign In Button and How can we replace this behaviour with progress bar?

Viewed 64

I searched everywhere regarding this behavior but did not find anything related. Whenever I am clicking on Google Sign In Button the screen gets dim for a while and then shows Account Selection Dialog but What I want is to replace this behavior with a progress bar.

My code sample use for signing in:

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.google_signin_token))
            .requestEmail()
            .build()

        googleSignInClient = GoogleSignIn.getClient(requireActivity(), gso)


btnLogin?.setOnClickListener(View.OnClickListener {
     val signInIntent = googleSignInClient.signInIntent
        startActivityForResult(signInIntent, RC_SIGN_IN)
})


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    if (requestCode == RC_SIGN_IN) {
        var result = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
        updateUI(result.isSuccess)
    }
}

Here above when I am clicking on then, the screen gets dim for a while before showing the dialog.

The screenshots can be seen below:

  1. Screenshot before onClick:

    View before onClick

  2. Screenshot after onClick:

    View After onClick

  3. Screenshot AtLast:

    View AtLast

0 Answers
Related