Esempio n. 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    Intent invokingIntent = getIntent();
    mAddingNewAccount = invokingIntent.getStringExtra(ARG_IS_ADDING_NEW_ACCOUNT).equals("true");
    mEmail = invokingIntent.getStringExtra(ARG_ACCOUNT_NAME);
    mLoginLayout = new LoginLayout(mEmail, mAddingNewAccount, this);

    // initialize the authenticator response intent
    mAccountAuthenticatorResponse =
        getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);

    if (mAccountAuthenticatorResponse != null) {
      mAccountAuthenticatorResponse.onRequestContinued();
    }

    // depending on whether the activity was started in response to an authentication error, we want
    // to
    // start it with a proper layout
    final HttpLoginMessage.EError serverResponseCode =
        (HttpLoginMessage.EError) invokingIntent.getSerializableExtra(ARG_SERVER_RESPONSE_CODE);
    if (serverResponseCode == null) {
      setLayout(mLoginLayout);
    } else {
      processServerResponse(serverResponseCode);
    }
  }
Esempio n. 2
0
 /** Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present. */
 public void finish() {
   if (mAccountAuthenticatorResponse != null) {
     // send the result bundle back if set, otherwise send an error.
     if (mResultBundle != null) {
       mAccountAuthenticatorResponse.onResult(mResultBundle);
     } else {
       mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
     }
     mAccountAuthenticatorResponse = null;
   }
   super.finish();
 }