更新时间:2024-09-14 GMT+08:00
分享

自定义会议中加人

点击与会者列表右上角加人按钮的时候,会触发doAddAttendees的回调方法,用户可以自定义实现该方法,

选择需要加入到会议中的联系人并通过callback的onSuccess回传选择的联系人列表

使用场景

应用自身有自己的企业通讯录等,所以会中选择入会联系人需要自定义实现

注意事项

1.SDK初始化的时候必须传入这个配置sdkConfig才会生效

自定义加人配置接口:

sdkConfig.setAddAttendeesHandle(new CustomAddAttendeesHandle());

效果图如下图所示:

图1 Demo中自定义会中加人界面示例

示例代码:自定义加人处理方法示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//点击添加与会者界面注入,在方法中跳转到自己的选人界面
public class CustomAddAttendeesHandle implements IAddAttendeesHandle {
     private HwmCallback<List<AttendeeModel>> callback;    
     /**
      * curActivity调用的activity
      * selectedAccount 已选择的账号
      * isScheled        是否预约会议
      * callback 加人完成后返回已选中与会者列表
      **/
     @Override    
     public void doAddAttendees(Activity curActivity, List<AttendeeModel> selectedAccount, String selectParam, boolean isScheled, HwmCallback<List<AttendeeModel>> hwmCallback) {
          callback = hwmCallback;        
          //可以传入已经选择的与会者列表在自定义界面做操作
          Intent intent = new Intent(Utils.getApp(), AddPeopleByAppidAuthActivity.class);                     
          activity.startActivityForResult(intent,5000);    
      }
     @Override    
     public void dealContactSelect(Intent intent) {    
     }
     @Override    
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
          if (requestCode == 5000){
              if(null != callback){
                  //回调选中的与会者加入会议
                  callback.onSuccess(DemoUtil.selectModels);            
              }        
          }    
     }
}

示例代码:自定义加人界面处理,AddPeopleByAppidAuthActivity是示例的选人界面
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
public class AddPeopleByAppidAuthActivity extends Activity {
    private List<AttendeeModel> members;
    @SuppressLint("CheckResult")
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.customize_add_people_by_appid_auth);
        TextView thirdAccountIdTextView = findViewById(R.id.third_account_id);
        TextView sipNumberTextView = findViewById(R.id.sip_number);
        TextView userPhoneTextView = findViewById(R.id.user_phone);
        TextView userNameTextView = findViewById(R.id.user_name);
        findViewById(R.id.add_people).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String thirdAccountId = thirdAccountIdTextView.getText().toString();
                String sipNumber = sipNumberTextView.getText().toString();
                String phoneNumber = userPhoneTextView.getText().toString();
                //昵称选填,不填,则以企业通讯录的为准
                String name = userNameTextView.getText().toString();
                members = new ArrayList<>();
                //三种方式选一即可, 第三方通讯录的id,仅仅对appid登录方式有效
                if (!TextUtils.isEmpty(thirdAccountId)) {
                    AttendeeModel attendeeModel = AttendeeModel.buildAttendeeByThirdUserId(thirdAccountId, name);
                    members.add(attendeeModel);
                } else if (!TextUtils.isEmpty(sipNumber)) {
                    //三种方式选一即可,sip号码是会议企业通讯录的账号标示
                    AttendeeModel attendeeModel = AttendeeModel.buildAttendeeBySipNumber(sipNumber,name);
                    members.add(attendeeModel);
                } else if (!TextUtils.isEmpty(phoneNumber)) {
                    //三种方式选一即可, 手机号码需要外呼权限
                    AttendeeModel attendeeModel = AttendeeModel.buildAttendeeByPhone(phoneNumber, name);
                    members.add(attendeeModel);
                } else {
                    DemoUtil.showToast("三种入会方式需要选择一种");
                    return;
                }
                DemoUtil.selectModels = members;
                Intent intent = new Intent();
                setResult(1,intent);
                finish();
            }
        });
    }
}

相关文档