@Override public void onSuccess(GCAccountsCollection responseData) { if (accountType == null) { return; } for (GCAccountModel accountModel : responseData) { if (accountModel.getType().equalsIgnoreCase(accountType.getName())) { GCPreferenceUtil.get().setNameForAccount(accountType, accountModel.getUser().getName()); GCPreferenceUtil.get().setIdForAccount(accountType, accountModel.getId()); accountClicked(accountModel.getId(), accountType.getName()); } } }
@Override public void onClick(View v) { accountType = (AccountType) v.getTag(); if (GCPreferenceUtil.get().hasAccountId(accountType)) { accountClicked(GCPreferenceUtil.get().getAccountId(accountType), accountType.getName()); } else { GCAccountStore.getInstance(getApplicationContext()) .startAuthenticationActivity( ChooseServiceActivity.this, accountType, Constants.PERMISSIONS_SCOPE, Constants.CALLBACK_URL, Constants.CLIENT_ID, Constants.CLIENT_SECRET); } }
@Override protected void onResume() { super.onResume(); if (GCPreferenceUtil.get().hasAccountId(AccountType.PICASA)) { if (GCPreferenceUtil.get().hasAccountName(AccountType.PICASA)) { txtPicasa.setText(GCPreferenceUtil.get().getAccountName(AccountType.PICASA)); } } if (GCPreferenceUtil.get().hasAccountId(AccountType.FACEBOOK)) { if (GCPreferenceUtil.get().hasAccountName(AccountType.FACEBOOK)) { txtFacebook.setText(GCPreferenceUtil.get().getAccountName(AccountType.FACEBOOK)); } } if (GCPreferenceUtil.get().hasAccountId(AccountType.FLICKR)) { if (GCPreferenceUtil.get().hasAccountName(AccountType.FLICKR)) { txtFlickr.setText(GCPreferenceUtil.get().getAccountName(AccountType.FLICKR)); } } if (GCPreferenceUtil.get().hasAccountId(AccountType.INSTAGRAM)) { if (GCPreferenceUtil.get().hasAccountName(AccountType.INSTAGRAM)) { txtInstagram.setText(GCPreferenceUtil.get().getAccountName(AccountType.INSTAGRAM)); } } }