private void updateUI(FirebaseUser user) {
    hideProgressDialog();
    if (user != null) {
      mStatusTextView.setText(getString(R.string.google_status_fmt, user.getEmail()));
      mDetailTextView.setText(getString(R.string.firebase_status_fmt, user.getUid()));

      findViewById(R.id.sign_in_button).setVisibility(View.GONE);
      findViewById(R.id.sign_out_and_disconnect).setVisibility(View.VISIBLE);
    } else {
      mStatusTextView.setText(R.string.signed_out);
      mDetailTextView.setText(null);

      findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
      findViewById(R.id.sign_out_and_disconnect).setVisibility(View.GONE);
    }
  }
 @Override
 @WorkerThread
 @Nullable
 public FirebaseUser linkWithCredential(
     @NonNull FirebaseUser user, @NonNull AuthCredential credential) throws ExecutionException {
   AuthResult linkResult = await(user.linkWithCredential(credential));
   return linkResult == null ? null : linkResult.getUser();
 }