/** * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present. */ @Override public void finish() { if (accountAuthenticatorResponse != null) { // send the result bundle back if set, otherwise send an error. if (resultBundle != null) { accountAuthenticatorResponse.onResult(resultBundle); } else { accountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled"); } accountAuthenticatorResponse = null; } super.finish(); } }
/** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero. * @param icicle the save instance data of this Activity, may be null */ @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); accountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (accountAuthenticatorResponse != null) { accountAuthenticatorResponse.onRequestContinued(); } }
Account account = new Account("John Doe", "com.myapp.account"); ContentResolver.setIsSyncable(account, ContactsContract.AUTHORITY, 0); AccountManager am = AccountManager.get(LoginActivity.this); boolean accountCreated = am.addAccountExplicitly(account, "Password", null); Bundle extras = LoginActivity.this.getIntent().getExtras(); if(extras != null){ if (accountCreated) { AccountAuthenticatorResponse response = extras.getParcelable(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, "John Doe"); result.putString(AccountManager.KEY_ACCOUNT_TYPE, "com.myapp.account"); response.onResult(result); } }
@Override 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(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAccountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
/** Clean up the account authenticator stuff, see {@link AccountAuthenticatorActivity} */ @Override public void finish() { if (authenticatorResponse != null) { if (resultBundle != null) { authenticatorResponse.onResult(resultBundle); } else { authenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled"); } authenticatorResponse = null; } super.finish(); }
/** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero. * @param icicle the save instance data of this Activity, may be null */ protected void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
/** * 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(); } }
/** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero. * @param icicle the save instance data of this Activity, may be null */ protected void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
/** * Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present. */ @Override 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(); }
/** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero. * * @param icicle the save instance data of this Activity, may be null */ @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
/** * 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(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_single_frame_with_toolbar); initActionBar(); if (savedInstanceState == null) { if (getIntent().hasExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE)) { // If the above extra is present - this activity was started by // StubAccountAuthenticator. Therefore - show native login right away! replaceFragment(LoginNativeFragment.class, false, true, getIntent().getExtras()); } else { Bundle args; if (getIntent() != null && getIntent().getExtras() != null) args = getIntent().getExtras(); else args = new Bundle(); args.putInt(LoginChooserFragment.ARG_PLAY_ANIMATION, 1); replaceFragment(LoginChooserFragment.class, false, true, args); } } // This part was copy-pasted from AccountAuthenticatorActivity mAccountAuthenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
/** * 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(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); ButterKnife.bind(this); setSupportActionBar(toolbar); presenter = new CreateTokenPresenterImpl(this, this); mAccountManager = AccountManager.get(getBaseContext()); Intent intent = getIntent(); mAccountAuthenticatorResponse = intent.getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } accountName = intent.getStringExtra(Authenticator.ARG_ACCOUNT_NAME); mAuthTokenType = intent.getStringExtra(Authenticator.ARG_AUTH_TYPE); accountType = intent.getStringExtra(Authenticator.ARG_ACCOUNT_TYPE); mAuthTokenType = Authenticator.AUTHTOKEN_TYPE_FULL_ACCESS; builder = new MaterialDialog.Builder(this) .content(R.string.login) .cancelable(false) .progress(true, 0); }
/** * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present. */ @Override 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(); } }
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); setTheme(R.style.Theme_Piwigo_Login); super.onCreate(savedInstanceState); // Account authenticator stuff, applicable if user comes from "add account" in settings only // as ordinarily this is skipped to enable activity scene transitions authenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (authenticatorResponse != null) { authenticatorResponse.onRequestContinued(); } viewModel = ViewModelProviders.of(this, viewModelFactory).get(LoginViewModel.class); handleIntent(getIntent()); viewModel.getLoginSuccess().observe(this, this::loginSuccess); viewModel.getLoginError().observe(this, this::loginError); binding = DataBindingUtil.setContentView(this, R.layout.activity_login); binding.setViewModel(viewModel); }
result.putString(AccountManager.KEY_ACCOUNT_TYPE, AuthenticatorService.ANDROID_ACCOUNT_TYPE); state.authenticatorResponse.onResult(result); message += "authenticatorResponse; account.name=" + state.getAccount().getAccountName() + "; "; state.authenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");