コード例 #1
0
  @Override
  public ShareResult getErrorShareResult(int errCode, Object msg) {
    ShareResult result = new ShareResult(ShareType.Sohu, false);
    result.setCode(errCode);

    JSONObject json = getJSONObject(msg);

    if (json != null) {
      result.setMessage(json.optString("error"));
      result.setMessageCode(String.valueOf(errCode));
    }

    return result;
  }
コード例 #2
0
  @Override
  protected void onTransactionSuccess(int code, Object obj) {
    if (!isCancel()) {
      if (obj != null && obj instanceof JSONObject) {
        JSONObject json = (JSONObject) obj;
        ShareResult result = null;

        ShareBind shareBind = mChannel.getShareBind();

        shareBind.setName(json.optString("screen_name"));
        shareBind.setUserID(json.optString("id"));
        shareBind.setDomainUrl("http://t.sohu.com/people?uid=" + json.optString("id"));
        shareBind.setProfile(json.optString("profile_image_url"));

        String key = ShareService.getShareService().getPreferKey();
        ManagerShareBind.addShareBind(key, shareBind);

        result = new ShareResult(mChannel.getShareType(), true);
        result.setShareBind(shareBind);
        notifyMessage(code, result);
      }
    }
  }