|
|
|
@ -38,11 +38,13 @@ import com.unionmed.unionmedtv.bean.ImUserInfoBean; |
|
|
|
|
import com.unionmed.unionmedtv.bean.RemoteBean; |
|
|
|
|
import com.unionmed.unionmedtv.bean.Video; |
|
|
|
|
import com.unionmed.unionmedtv.livedatas.LiveDataBus; |
|
|
|
|
import com.unionmed.unionmedtv.meeting.MeetingActivity; |
|
|
|
|
import com.unionmed.unionmedtv.network.ApiResponse; |
|
|
|
|
import com.unionmed.unionmedtv.network.HttpData; |
|
|
|
|
import com.unionmed.unionmedtv.utils.CacheUtil; |
|
|
|
|
import com.unionmed.unionmedtv.utils.Constants; |
|
|
|
|
import com.unionmed.unionmedtv.utils.OnChildClickListener; |
|
|
|
|
import com.unionmed.unionmedtv.utils.UserInfoByServerUtil; |
|
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
@ -206,7 +208,9 @@ public class VideoCallActivity extends BaseActivity implements View.OnClickListe |
|
|
|
|
userIds, null, RongCallCommon.CallMediaType.VIDEO, null); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
changeUi(null); |
|
|
|
|
if (DoctorDetailActivity.checkCamera(VideoCallActivity.this)) { |
|
|
|
|
changeUi(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
getUserInfoByServer(targetId); |
|
|
|
|
} |
|
|
|
@ -302,34 +306,15 @@ public class VideoCallActivity extends BaseActivity implements View.OnClickListe |
|
|
|
|
multiCallEndMessage.setReason(reason); |
|
|
|
|
multiCallEndMessage.setMediaType(RongIMClient.MediaType.AUDIO); |
|
|
|
|
long serverTime = System.currentTimeMillis() - RongIMClient.getInstance().getDeltaTime(); |
|
|
|
|
// RongIMClient.getInstance()
|
|
|
|
|
// .insertIncomingMessage(
|
|
|
|
|
// callSession.getConversationType(),
|
|
|
|
|
// callSession.getTargetId(),
|
|
|
|
|
// callSession.getCallerUserId(),
|
|
|
|
|
// getReceivedStatus(reason),
|
|
|
|
|
// multiCallEndMessage,
|
|
|
|
|
// serverTime,
|
|
|
|
|
// null);
|
|
|
|
|
Message message = Message.obtain(callSession.getTargetId(), callSession.getConversationType(), multiCallEndMessage); |
|
|
|
|
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onAttached(Message message) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onSuccess(Message message) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onError(Message message, RongIMClient.ErrorCode errorCode) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
RongIMClient.getInstance() |
|
|
|
|
.insertIncomingMessage( |
|
|
|
|
callSession.getConversationType(), |
|
|
|
|
callSession.getTargetId(), |
|
|
|
|
callSession.getCallerUserId(), |
|
|
|
|
getReceivedStatus(reason), |
|
|
|
|
multiCallEndMessage, |
|
|
|
|
serverTime, |
|
|
|
|
null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -513,6 +498,7 @@ public class VideoCallActivity extends BaseActivity implements View.OnClickListe |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Message.ReceivedStatus getReceivedStatus( |
|
|
|
|
RongCallCommon.CallDisconnectedReason reason) { |
|
|
|
|
// 己方超时未接听或是对方取消通话时,应插入未读消息
|
|
|
|
@ -523,6 +509,7 @@ public class VideoCallActivity extends BaseActivity implements View.OnClickListe |
|
|
|
|
// 默认是已读状态
|
|
|
|
|
return new Message.ReceivedStatus(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void changeUi(RongCallCommon.CallDisconnectedReason reason) { |
|
|
|
|
if (CallStatus.Idle == currentStatus) {//通话结束
|
|
|
|
|
|
|
|
|
@ -584,45 +571,42 @@ public class VideoCallActivity extends BaseActivity implements View.OnClickListe |
|
|
|
|
|
|
|
|
|
//获取用户信息
|
|
|
|
|
private void getUserInfoByServer(String userId) { |
|
|
|
|
EasyHttp.post(VideoCallActivity.this) |
|
|
|
|
.api(new GetImUserInfoApi(CacheUtil.getToken().getToken(), userId)) |
|
|
|
|
.request(new OnHttpListener<HttpData<ApiResponse<ImUserInfoBean>>>() { |
|
|
|
|
@Override |
|
|
|
|
public void onHttpSuccess(HttpData<ApiResponse<ImUserInfoBean>> result) { |
|
|
|
|
if (null != result.getData() && result.getData().isInnerRequestSucceed() |
|
|
|
|
&& null != result.getData().getData()) { |
|
|
|
|
if (currentStatus != CallStatus.OnCall) { //等待接听状态
|
|
|
|
|
Glide.with(VideoCallActivity.this) |
|
|
|
|
.load(result.getData().getData().getHeadImg()) |
|
|
|
|
.apply(new RequestOptions() |
|
|
|
|
.placeholder(R.color.white_e1e1e1) |
|
|
|
|
) |
|
|
|
|
.into(iv_icon); |
|
|
|
|
tv_name.setText(result.getData().getData().getName()); |
|
|
|
|
if (type.equals("1")) { |
|
|
|
|
tv_tip.setText("等待对方接听"); |
|
|
|
|
} else { |
|
|
|
|
tv_tip.setText("对方邀请您进行通话"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (usetInfo != null) { |
|
|
|
|
usetInfo.success(result.getData().getData()); |
|
|
|
|
} |
|
|
|
|
UserInfoByServerUtil.getUserInfoByServer(VideoCallActivity.this, userId, new UserInfoByServerUtil.UserInfoInterface() { |
|
|
|
|
@Override |
|
|
|
|
public void success(HttpData<ApiResponse<ImUserInfoBean>> result) { |
|
|
|
|
if (null != result.getData() && result.getData().isInnerRequestSucceed() |
|
|
|
|
&& null != result.getData().getData()) { |
|
|
|
|
if (currentStatus != CallStatus.OnCall) { //等待接听状态
|
|
|
|
|
Glide.with(VideoCallActivity.this) |
|
|
|
|
.load(result.getData().getData().getHeadImg()) |
|
|
|
|
.apply(new RequestOptions() |
|
|
|
|
.placeholder(R.color.white_e1e1e1) |
|
|
|
|
) |
|
|
|
|
.into(iv_icon); |
|
|
|
|
tv_name.setText(result.getData().getData().getName()); |
|
|
|
|
if (type.equals("1")) { |
|
|
|
|
tv_tip.setText("等待对方接听"); |
|
|
|
|
} else { |
|
|
|
|
if (usetInfo != null) { |
|
|
|
|
usetInfo.fail(); |
|
|
|
|
} |
|
|
|
|
LogUtils.e("用户信息数据解析失败"); |
|
|
|
|
tv_tip.setText("对方邀请您进行通话"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onHttpFail(Exception e) { |
|
|
|
|
ToastUtils.showLong(e.getMessage()); |
|
|
|
|
LogUtils.e("用户信息失败", "失败:" + e); |
|
|
|
|
if (usetInfo != null) { |
|
|
|
|
usetInfo.success(result.getData().getData()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (usetInfo != null) { |
|
|
|
|
usetInfo.fail(); |
|
|
|
|
} |
|
|
|
|
LogUtils.e("用户信息数据解析失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
@Override |
|
|
|
|
public void Fail(String e) { |
|
|
|
|
ToastUtils.showLong(e); |
|
|
|
|
LogUtils.e("用户信息失败", "失败:" + e); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|