コード例 #1
0
  private void invitePeopleInPublicCircle(
      final String circleId,
      final String toids,
      final String toNames,
      final String message,
      final boolean sendEmail,
      final boolean sendSms) {
    if (inInvitePeople == true) {
      ToastUtil.showShortToast(this, mHandler, R.string.string_in_processing);
      return;
    }

    synchronized (mLockInvitePeople) {
      inInvitePeople = true;
    }

    mprogressDialog =
        DialogUtils.showProgressDialog(
            this, -1, getString(R.string.invite_progress_dialog_message));

    asyncQiupu.publicInvitePeople(
        AccountServiceUtils.getSessionID(),
        circleId,
        toids,
        toNames,
        message,
        sendEmail,
        sendSms,
        new TwitterAdapter() {
          public void publicInvitePeople(ArrayList<Long> joinIds) {
            Log.d(TAG, "finish invitePeopleInPublicCircle=" + joinIds.size());
            invitePeopleCallback(joinIds);

            Message msg = mHandler.obtainMessage(INVIT_PEOPLE_END);
            msg.getData().putBoolean(RESULT, true);
            msg.sendToTarget();
            synchronized (mLockInvitePeople) {
              inInvitePeople = false;
            }
          }

          public void onException(TwitterException ex, TwitterMethod method) {
            synchronized (mLockInvitePeople) {
              inInvitePeople = false;
            }
            Message msg = mHandler.obtainMessage(INVIT_PEOPLE_END);
            msg.getData().putBoolean(RESULT, false);
            msg.sendToTarget();
          }
        });
  }
コード例 #2
0
  private void sendchangeRequest(HashMap<String, String> map) {
    synchronized (mSendRequestLock) {
      if (insendRequestProcess == true) {
        Log.d(TAG, "in loading info data");
        return;
      }
    }
    showProcessDialog(R.string.request_process_title, false, true, true);

    synchronized (mSendRequestLock) {
      insendRequestProcess = true;
    }
    asyncQiupu.sendChangeRequest(
        AccountServiceUtils.getSessionID(),
        map,
        new TwitterAdapter() {
          public void sendChangeRequest(boolean result) {
            Log.d(TAG, "finish edit user profile");
            Message msg = mHandler.obtainMessage(CHANGE_REQUEST_END);
            msg.getData().putBoolean(BasicActivity.RESULT, result);
            msg.sendToTarget();
            synchronized (mSendRequestLock) {
              insendRequestProcess = false;
            }
          }

          public void onException(TwitterException ex, TwitterMethod method) {

            synchronized (mSendRequestLock) {
              insendRequestProcess = false;
            }
            TwitterExceptionUtils.printException(
                TAG, "sendchangeRequest, server exception:", ex, method);

            Message msg = mHandler.obtainMessage(CHANGE_REQUEST_END);
            msg.getData().putString(BasicActivity.ERROR_MSG, ex.getMessage());
            msg.getData().putBoolean(BasicActivity.RESULT, false);
            msg.sendToTarget();
          }
        });
  }