Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RestClient.INSTANCE.getLoginRestApi().getSelfProfileInfo(authHeader).enqueue(new Callback<List<ProfileInfo>>() {
- @Override
- public void onResponse(Response<List<ProfileInfo>> response, Retrofit retrofit) {
- List<ProfileInfo> profileInfos = response.body();
- Log.d(TAG, "Profiles count: " + (profileInfos == null ? 0 : profileInfos.size()));
- mProgressLayout.setVisibility(View.GONE);
- if (profileInfos == null || profileInfos.isEmpty()) {
- mAuthIncorrectTextView.setVisibility(View.VISIBLE);
- } else {
- ProfileInfo profileInfo = profileInfos.get(0);
- Account account = AccountUtils.addAccount(AuthActivity.this, profileInfo,
- password);
- final Intent intent = new Intent();
- intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
- intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
- intent.putExtra(AccountManager.KEY_PASSWORD, password);
- setAccountAuthenticatorResult(intent.getExtras());
- setResult(RESULT_OK, intent);
- mAuthIncorrectTextView.setVisibility(View.GONE);
- finish();
- }
- }
- @Override
- public void onFailure(Throwable t) {
- t.printStackTrace();
- mProgressLayout.setVisibility(View.GONE);
- mAuthIncorrectTextView.setVisibility(View.VISIBLE);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement