Exemplo n.º 1
0
 public boolean addAccount(VAccount account) {
   if (account == null) {
     return false;
   }
   try {
     this.sinaWeibo.setOAuthAccessToken(account.getAccessToken(), account.getTokenSecret());
     weibo4android.User me = this.sinaWeibo.verifyCredentials();
     if (me != null) {
       account.setUserName(me.getScreenName());
       CactusDb.getInstance().saveAccount(account);
     } else {
       return false;
     }
   } catch (WeiboException e) {
     e.printStackTrace();
     return false;
   }
   this.accountAdapter.add(account);
   if (this.activatedAccount != null) {
     this.sinaWeibo.setOAuthAccessToken(
         this.activatedAccount.getAccessToken(), this.activatedAccount.getTokenSecret());
   } else {
     this.activatedAccount = account;
   }
   return true;
 }
Exemplo n.º 2
0
 public boolean activateAccount(VAccount account) {
   if (account == null) {
     return false;
   }
   if (this.activatedAccount != null && account.getId() == this.activatedAccount.getId()) {
     return true;
   }
   this.activatedAccount = account;
   switch (account.getServiceProvider()) {
     case SP_SINA_WEIBO:
       {
         this.sinaWeibo.setOAuthAccessToken(account.getAccessToken(), account.getTokenSecret());
         this.retrieveStatuses();
         return true;
       }
     default:
       return false;
   }
 }