Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. RestClient.INSTANCE.getLoginRestApi().getSelfProfileInfo(authHeader).enqueue(new Callback<List<ProfileInfo>>() {
  2. @Override
  3. public void onResponse(Response<List<ProfileInfo>> response, Retrofit retrofit) {
  4. List<ProfileInfo> profileInfos = response.body();
  5. Log.d(TAG, "Profiles count: " + (profileInfos == null ? 0 : profileInfos.size()));
  6. mProgressLayout.setVisibility(View.GONE);
  7. if (profileInfos == null || profileInfos.isEmpty()) {
  8. mAuthIncorrectTextView.setVisibility(View.VISIBLE);
  9. } else {
  10. ProfileInfo profileInfo = profileInfos.get(0);
  11. Account account = AccountUtils.addAccount(AuthActivity.this, profileInfo,
  12. password);
  13. final Intent intent = new Intent();
  14. intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
  15. intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
  16. intent.putExtra(AccountManager.KEY_PASSWORD, password);
  17. setAccountAuthenticatorResult(intent.getExtras());
  18. setResult(RESULT_OK, intent);
  19. mAuthIncorrectTextView.setVisibility(View.GONE);
  20. finish();
  21. }
  22. }
  23.  
  24. @Override
  25. public void onFailure(Throwable t) {
  26. t.printStackTrace();
  27. mProgressLayout.setVisibility(View.GONE);
  28. mAuthIncorrectTextView.setVisibility(View.VISIBLE);
  29. }
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement