コード例 #1
0
ファイル: ShareQQWeibo.java プロジェクト: lihonghao1017/app
  public void shareQQweibo(String accessToken) {
    mCallBack =
        new HttpCallback() {

          @Override
          public void onResult(Object object) {
            Logger.i(TAG, "mCallBack---" + object);
            ModelResult result = (ModelResult) object;
            if (result != null && result.isSuccess()) {
              MessageToast.showToast(R.string.share_success, 0);
            } else {
              MessageToast.showToast(R.string.share_fail, 0);
            }
          }
        };
    AccountModel account = new AccountModel(accessToken);
    weiboAPI = new WeiboAPI(account);
    String content = "[ " + shareModel.type_title + " ] " + shareModel.content_title;
    Bitmap bm = BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.share_icon);
    weiboAPI.addPic(mContext, content, "json", 0, 0, bm, 0, 0, mCallBack, null, BaseVO.TYPE_JSON);
  }
コード例 #2
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case 1001:
        timeLineAPI.getHomeTimeLine(
            context, 0, 0, 30, 0, 0, requestFormat, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1002:
        timeLineAPI.getUserTimeLine(
            context,
            0,
            0,
            20,
            0,
            "t",
            null,
            0,
            0,
            requestFormat,
            mCallBack,
            null,
            BaseVO.TYPE_JSON);
        break;
      case 1003:
        weiboAPI.addWeibo(
            context,
            "hello world !",
            requestFormat,
            longitude,
            latitude,
            0,
            0,
            mCallBack,
            null,
            BaseVO.TYPE_JSON);
        break;
      case 1004:
        try {
          Bitmap bm =
              BitmapFactory.decodeStream(
                  context.getAssets().open("logo.png")); // BitmapFactory.decodeFile(pic);
          weiboAPI.addPic(
              context,
              "call telephone OKK",
              requestFormat,
              longitude,
              latitude,
              bm,
              0,
              0,
              mCallBack,
              null,
              BaseVO.TYPE_JSON);
        } catch (Exception e) {
          e.printStackTrace();
        }
        break;
      case 1005:
        String picUrl = "http://t2.qpic.cn/mblogpic/9c7e34358608bb61a696/2000";
        weiboAPI.addPicUrl(
            context,
            "y phone ",
            requestFormat,
            longitude,
            latitude,
            picUrl,
            0,
            0,
            mCallBack,
            null,
            BaseVO.TYPE_JSON);
        break;
      case 1006:
        timeLineAPI.getHTTimeLine(
            context,
            requestFormat,
            30,
            "0",
            "0",
            0,
            0,
            "加油",
            "0",
            1,
            0x80,
            mCallBack,
            null,
            BaseVO.TYPE_JSON);
        break;
      case 1007: // 获取用户信息
        userAPI.getUserInfo(context, requestFormat, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1008: // 获取他人信息
        userAPI.getUserOtherInfo(
            context, requestFormat, "api_weibo", null, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1009: // 获取一批人信息
        userAPI.getUserInfos(
            context, requestFormat, "api_weibo", null, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1010: // 收听某个用户
        friendAPI.addFriend(
            context, requestFormat, "api_weibo", null, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1011: // 获取偶像列表
        friendAPI.friendIDolList(
            context, requestFormat, 30, 0, 1, 0, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1012: // 获取粉丝列表
        friendAPI.friendFansList(
            context, requestFormat, 30, 0, 1, 0, 0, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1013:
        friendAPI.getMutualList(
            context, requestFormat, "api_weibo", null, 0, 30, 0, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1014: // 验证好友关系
        friendAPI.friendCheck(
            context, requestFormat, "api_weibo", null, 2, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1015: // 转播获取转播列表
        weiboAPI.reList(
            context,
            requestFormat,
            2,
            "112714089895346",
            0,
            "0",
            30,
            "0",
            mCallBack,
            null,
            BaseVO.TYPE_JSON);
        break;
      case 1016: // 获取最近联系人
        friendAPI.getIntimateFriends(context, requestFormat, 30, mCallBack, null, BaseVO.TYPE_JSON);
        break;
      case 1017: // 获取附近的人
        if (!locatedFlag) {
          Toast.makeText(context, "获取位置信息失败,请稍后再试", Toast.LENGTH_SHORT).show();
          return;
        } else {
          lbsAPI.getAroundPeople(
              context,
              requestFormat,
              longitude,
              latitude,
              "",
              20,
              0,
              mCallBack,
              null,
              BaseVO.TYPE_JSON);
        }
        break;
      case 1018: // 获取身边最新的微博
        if (!locatedFlag) {
          Toast.makeText(context, "获取位置信息失败,请稍后再试", Toast.LENGTH_SHORT).show();
          return;
        } else {
          lbsAPI.getAroundNew(
              context,
              requestFormat,
              longitude,
              latitude,
              "",
              20,
              mCallBack,
              null,
              BaseVO.TYPE_JSON);
        }
        break;
      case 1019:
        break;
      case 1020:
        break;
      default:
        break;
    }

    Looper.myQueue()
        .addIdleHandler(
            new IdleHandler() {
              @Override
              public boolean queueIdle() {
                // TODO Auto-generated method stub
                loadingWindow.showAtLocation(scrollView, Gravity.CENTER, 0, 80);
                return false;
              }
            });
  }