예제 #1
0
  public boolean postWeibo(String text) {
    Status sinaStatus = sinaAPIHelper.postWeibo(text);
    WeiboStatus tencentStatus = tencentAPIHelper.postWeibo(text);

    if (sinaStatus != null && tencentStatus != null) {
      dbHelper.saveTencentWeiboStatus(tencentStatus);
      return true;
    } else {
      return false;
    }
  }
예제 #2
0
  private void synchronizeToALL() {
    ArrayList<WeiboStatus> unSynchronizedList = dbHelper.getUnSynchronizedWeiboStatusList();
    for (int i = 0; i < unSynchronizedList.size(); i++) {
      WeiboStatus currentStatus = unSynchronizedList.get(i);
      if (currentStatus.getSource().equals("s")) {
        WeiboStatus tencentStatus = tencentAPIHelper.postWeibo(currentStatus.getText());
        dbHelper.saveTencentWeiboStatus(tencentStatus);

      } else {
        Status status = sinaAPIHelper.postWeibo(currentStatus.getText());
        WeiboStatus sinaWeiboStatus = new WeiboStatus(status);
        dbHelper.saveSinaWeiboStatus(sinaWeiboStatus);
      }

      dbHelper.changeIsSynchronize(currentStatus);
      try {
        Thread.sleep(15000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }