protected void onCreate()

in auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java [92:182]


    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        FlowParameters params = getFlowParams();
        customLayout = params.authMethodPickerLayout;

        mHandler = new ViewModelProvider(this).get(SocialProviderResponseHandler.class);
        mHandler.init(params);


        mProviders = new ArrayList<>();
        if (customLayout != null) {
            setContentView(customLayout.getMainLayout());

            //Setup using custom layout
            populateIdpListCustomLayout(params.providers);
        } else {
            setContentView(R.layout.fui_auth_method_picker_layout);

            //UI only with default layout
            mProgressBar = findViewById(R.id.top_progress_bar);
            mProviderHolder = findViewById(R.id.btn_holder);

            populateIdpList(params.providers);

            int logoId = params.logoId;
            if (logoId == AuthUI.NO_LOGO) {
                findViewById(R.id.logo).setVisibility(View.GONE);

                ConstraintLayout layout = findViewById(R.id.root);
                ConstraintSet constraints = new ConstraintSet();
                constraints.clone(layout);
                constraints.setHorizontalBias(R.id.container, 0.5f);
                constraints.setVerticalBias(R.id.container, 0.5f);
                constraints.applyTo(layout);
            } else {
                ImageView logo = findViewById(R.id.logo);
                logo.setImageResource(logoId);
            }
        }

        boolean tosAndPpConfigured = getFlowParams().isPrivacyPolicyUrlProvided()
                && getFlowParams().isTermsOfServiceUrlProvided();

        int termsTextId = customLayout == null
                ? R.id.main_tos_and_pp
                : customLayout.getTosPpView();

        if (termsTextId >= 0) {
            TextView termsText = findViewById(termsTextId);

            // No ToS or PP provided, so we should hide the view entirely
            if (!tosAndPpConfigured) {
                termsText.setVisibility(View.GONE);
            } else {
                PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(this,
                        getFlowParams(),
                        termsText);
            }
        }

        //Handler for both
        mHandler.getOperation().observe(this, new ResourceObserver<IdpResponse>(
                this, R.string.fui_progress_dialog_signing_in) {
            @Override
            protected void onSuccess(@NonNull IdpResponse response) {
                startSaveCredentials(mHandler.getCurrentUser(), response, null);
            }

            @Override
            protected void onFailure(@NonNull Exception e) {
                if (e instanceof UserCancellationException) {
                    // User pressed back, there is no error.
                    return;
                }

                if (e instanceof FirebaseAuthAnonymousUpgradeException) {
                    finish(ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT,
                            ((FirebaseAuthAnonymousUpgradeException) e).getResponse().toIntent());
                } else if (e instanceof FirebaseUiException) {
                    FirebaseUiException fue = (FirebaseUiException) e;
                    finish(RESULT_CANCELED, IdpResponse.from(fue).toIntent());
                } else {
                    String text = getString(R.string.fui_error_unknown);
                    Toast.makeText(AuthMethodPickerActivity.this,
                            text,
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
    }