Search in sources :

Example 6 with CallPartnerView

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();
                }
            }
        }
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 7 with CallPartnerView

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;
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView) Nullable(android.support.annotation.Nullable)

Example 8 with CallPartnerView

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;
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 9 with CallPartnerView

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();
    }
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView) UiThread(android.support.annotation.UiThread)

Example 10 with CallPartnerView

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());
        }
    });
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Aggregations

CallPartnerView (com.fanap.podcall.view.CallPartnerView)19 CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)7 UiThread (android.support.annotation.UiThread)3 PodCallBuilder (com.fanap.podcall.PodCallBuilder)3 CallPartner (com.fanap.podcall.model.CallPartner)3 Nullable (android.support.annotation.Nullable)1 CallInfo (com.fanap.podchat.call.model.CallInfo)1 ClientDTO (com.fanap.podchat.call.model.ClientDTO)1 SwapViewsRequest (com.fanap.podchat.call.request_model.SwapViewsRequest)1 ScreenShareResult (com.fanap.podchat.call.request_model.screen_share.ScreenShareResult)1 JoinCallParticipantResult (com.fanap.podchat.call.result_model.JoinCallParticipantResult)1 Participant (com.fanap.podchat.mainmodel.Participant)1 AndroidLogAdapter (com.orhanobut.logger.AndroidLogAdapter)1 ArrayList (java.util.ArrayList)1