コード例 #1
0
  void updatePresence(int status, String statusText) {
    if (mPresence == null) {
      // No connection yet. Don't allow to update presence yet.
      return;
    }

    Presence newPresence = new Presence(mPresence);

    if (status != -1) {
      newPresence.setStatus(status);
    }

    if (statusText != null) newPresence.setStatusText(statusText);

    try {
      int res = mConn.updateUserPresence(newPresence);
      if (res != ImErrorInfo.NO_ERROR) {
        mHandler.showAlert(R.string.error, ErrorResUtils.getErrorRes(getResources(), res));
      } else {
        mPresence = newPresence;
        updateView();
      }
    } catch (RemoteException e) {
      mHandler.showServiceErrorAlert();
    }
  }
コード例 #2
0
 public Presence(
     int status,
     String statusText,
     byte[] avatarData,
     String avatarType,
     int clientType,
     Map<String, String> extendedInfo,
     String resource) {
   setStatus(status);
   mStatusText = statusText;
   setAvatar(avatarData, avatarType);
   mClientType = clientType;
   mExtendedInfo = extendedInfo;
   mResource = resource;
 }