コード例 #1
0
    private void openClient(final User targetUser) {
      final User user = User.getCurrentUser(User.class);

      AVImClientManager.getInstance()
          .open(
              user.getUsername(),
              new AVIMClientCallback() {
                @Override
                public void done(AVIMClient avimClient, AVIMException e) {
                  if (filterException(e)) {
                    Notification notification = new Notification();
                    notification.setMessage("私聊");
                    notification.setUser(user.getUsername());
                    notification.setUserName(user.getNickname());
                    notification.setTargetUser(targetUser.getUsername());
                    notification.setTargetUserName(targetUser.getNickname());
                    notification.saveInBackground();

                    Intent intent = new Intent(mContext, AVSingleChatActivity.class);
                    intent.putExtra(Constants.MEMBER_ID, targetUser.getUsername());
                    intent.putExtra(Constants.ACTIVITY_TITLE, targetUser.getNickname());
                    mContext.startActivity(intent);
                  }
                }
              });
    }
コード例 #2
0
 private String getTextByUser(String tag) {
   switch (tag) {
     case "nickname":
       return mUser.getNickname();
     case "birthday":
       return mUser.getBirthday();
     case "sex":
       return mUser.getSex();
     case "earning":
       return mUser.getEarning();
     case "education":
       return mUser.getEducation();
     case "height":
       return mUser.getHeight();
     case "state":
       return mUser.getState();
     default:
       return "";
   }
 }