use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.
the class Chat method addVideoCallPartner.
private void addVideoCallPartner(ChatResponse<JoinCallParticipantResult> response) {
for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
if (callParticipant.getUserId().equals(CoreConfig.userId)) {
CallPartner.Builder lCallPartnerBuilder = new CallPartner.Builder();
lCallPartnerBuilder.setPartnerType(PartnerType.LOCAL);
lCallPartnerBuilder.setName("You");
if (localPartnerView != null) {
visibleView(localPartnerView);
localPartnerView.setPartnerId(CoreConfig.userId);
localPartnerView.setPartnerName("You");
lCallPartnerBuilder.setVideoTopic(callParticipant.getSendTopicVideo());
lCallPartnerBuilder.setVideoView(localPartnerView);
}
podVideoCall.addPartner(lCallPartnerBuilder.build());
// todo fire an event for local partner
} else {
Long userId = callParticipant.getUserId();
if (hasRemotePartnerView()) {
CallPartnerView view = assignCallPartnerView(callParticipant.getUserId());
if (view != null) {
view.setPartnerName(callParticipant.getParticipantVO() != null ? callParticipant.getParticipantVO().getName() : "");
visibleView(view);
podVideoCall.addPartnerVideo(userId, view);
listenerManager.callOnCallParticipantStartedVideo(response);
} else {
listenerManager.callOnNoViewToAddNewPartnerError();
}
}
}
}
}
use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.
the class CallPartnerViewPool method assignViewToPartnerByUserId.
/*
Chat Use Cases Implementation
*/
@Override
@Nullable
public CallPartnerView assignViewToPartnerByUserId(Long partnerUserId) {
checkIsMapInitialized();
if (!partnerHasView(partnerUserId)) {
CallPartnerView unAssignedViewFromList = getUnAssignedView();
if (unAssignedViewFromList != null) {
unAssignedViewFromList.setPartnerId(partnerUserId);
getValidUserIdToViewMap().put(partnerUserId, unAssignedViewFromList);
return unAssignedViewFromList;
} else if (autoGenerate) {
return generatePartnerView(partnerUserId);
}
} else
return getPartnerAssignedView(partnerUserId);
return null;
}
use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.
the class CallPartnerViewPool method assignScreenShareView.
@Override
public CallPartnerView assignScreenShareView() throws NullPointerException {
if (screenShareView != null)
return screenShareView;
checkIsMapInitialized();
if (viewListIsNotEmpty()) {
CallPartnerView unAssignedViewFromList = getUnAssignedView();
if (unAssignedViewFromList != null) {
screenShareView = unAssignedViewFromList;
screenShareView.setPartnerId(SCREEN_SHARE_ID);
getValidUserIdToViewMap().put(SCREEN_SHARE_ID, screenShareView);
return screenShareView;
} else if (autoGenerate) {
return autoGenerateScreenShareView();
}
} else if (autoGenerate) {
return autoGenerateScreenShareView();
}
return null;
}
use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.
the class CallPartnerViewManager method releasePartnerView.
@UiThread
@Override
public void releasePartnerView(Long partnerUserId) {
CallPartnerView partnerView = getPartnerUnAssignedView(partnerUserId) != null ? getPartnerUnAssignedView(partnerUserId) : getPartnerAssignedView(partnerUserId);
if (partnerView != null) {
partnerView.setVisibility(View.GONE);
partnerView.setPartnerId(CallPartnerViewPool.NOT_ASSIGNED);
partnerView.setPartnerName("");
partnerView.setDisplayName(false);
partnerView.setDisplayIsMuteIcon(false);
partnerView.setDisplayCameraIsOffIcon(false);
partnerView.reset();
}
}
use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.
the class CallPresenter method onCallParticipantLeft.
@Override
public void onCallParticipantLeft(ChatResponse<LeaveCallResult> response) {
for (CallParticipantVO c : response.getResult().getCallParticipants()) {
view.showMessage(c.getParticipantVO().getName() + " تماس رو ترک کرد");
}
activity.runOnUiThread(() -> {
try {
if (cpvManager != null) {
cpvManager.releasePartnerView(response.getResult().getCallParticipants().get(0).getUserId());
} else {
CallPartnerView pw = findParticipantView(response.getResult().getCallParticipants().get(0).getUserId());
if (pw != null) {
pw.setId(0);
pw.setPartnerName("");
pw.setDisplayName(false);
pw.setDisplayIsMuteIcon(false);
pw.setDisplayCameraIsOffIcon(false);
pw.reset();
chat.addPartnerView(pw, 0);
}
}
} catch (Exception e) {
view.onError(e.getMessage());
}
});
}
Aggregations