示例#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;
 }
示例#2
0
 private int mergeStatus(List<weibo4android.Status> source) {
   int upCount = 0;
   if (source == null) {
     return upCount;
   }
   int i = source.size() - 1;
   for (; i >= 0; --i) {
     VStatus status = new VStatus(VStatus.HOME, source.get(i));
     if (this.statusAdapter.addStatusInOrder(status)) {
       upCount++;
       CactusDb.getInstance().saveStatus(status);
       CactusDb.getInstance().saveUser(status.getUser());
     }
   }
   this.refreshCounts();
   return upCount;
 }
示例#3
0
 public void retrieveStatuses() {
   this.statusAdapter.cleanup();
   if (this.activatedAccount == null) {
     return;
   }
   this.statusAdapter.addStatuses(
       CactusDb.getInstance()
           .getStatusByAccountCatalog(
               this.activatedAccount.getServiceProvider(),
               this.activatedAccount.getId(),
               VStatus.HOME));
   this.statusAdapter.notifyDataSetChanged();
   this.refreshCounts();
 }
示例#4
0
 public void retrieveAccounts() {
   this.accountAdapter.addAll(CactusDb.getInstance().getAccounts());
   this.statusAdapter.notifyDataSetChanged();
 }