Search in sources :

Example 11 with CallPartnerView

use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method onCallParticipantStoppedVideo.

@Override
public void onCallParticipantStoppedVideo(ChatResponse<JoinCallParticipantResult> response) {
    try {
        view.showMessage(response.getResult().getJoinedParticipants().get(0).getParticipantVO().getName() + " دوربینش رو بست! ");
        if (cpvManager != null) {
            activity.runOnUiThread(() -> cpvManager.releasePartnerView(response.getResult().getJoinedParticipants().get(0).getUserId()));
            return;
        }
        CallPartnerView pw = findParticipantView(response.getResult().getJoinedParticipants().get(0).getUserId());
        activity.runOnUiThread(() -> {
            if (pw != null) {
                pw.setPartnerName("");
                pw.setPartnerId(0L);
                pw.reset();
                pw.setVisibility(View.GONE);
                chat.addPartnerView(pw, 0);
            }
        });
    } catch (Exception e) {
        view.onError(e.getMessage());
    }
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 12 with CallPartnerView

use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method onCallPartnerViewSelected.

@Override
public void onCallPartnerViewSelected(CallPartnerView secondPartnerView) {
    if (isInCall) {
        CallPartnerView mainPartnerView = remotePartnersViews.get(0);
        Long mainPartnerId = mainPartnerView.getPartnerId();
        Long secondPartnerId = secondPartnerView.getPartnerId();
        SwapViewsRequest request = new SwapViewsRequest.Builder().setFirstPartnerUserId(mainPartnerId).setSecondPartnerUserId(secondPartnerId).setFirstPartnerView(mainPartnerView).setSecondPartnerView(secondPartnerView).build();
        chat.swapPartnerViews(request);
    }
}
Also used : SwapViewsRequest(com.fanap.podchat.call.request_model.SwapViewsRequest) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 13 with CallPartnerView

use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.

the class CallPartnerViewPool method generatePartnerView.

private CallPartnerView generatePartnerView(long partnerUserId) {
    CallPartnerView newPartnerView = null;
    try {
        checkIsListInitialized();
        if (isOnMaximumNumberOfViews(partnerUserId))
            return null;
        newPartnerView = new CallPartnerView(getContextFromPartnerView());
        newPartnerView.setPartnerId(partnerUserId);
        addView(newPartnerView);
        checkIsMapInitialized();
        getValidUserIdToViewMap().put(partnerUserId, newPartnerView);
        callOnNewViewGenerated(newPartnerView);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return newPartnerView;
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 14 with CallPartnerView

use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.

the class CallPartnerViewPool method generatePartnerView.

private CallPartnerView generatePartnerView() {
    CallPartnerView newPartnerView = null;
    try {
        newPartnerView = new CallPartnerView(getContextFromPartnerView());
        checkIsListInitialized();
        addView(newPartnerView);
        callOnNewViewGenerated(newPartnerView);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return newPartnerView;
}
Also used : CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 15 with CallPartnerView

use of com.fanap.podcall.view.CallPartnerView in project pod-chat-android-sdk by FanapSoft.

the class CallPartnerViewPool method setPartnerView.

@Override
public boolean setPartnerView(Long partnerUserId, CallPartnerView newView) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (Objects.equals(partnerUserId, NOT_ASSIGNED) || partnerUserId < 0)
            return false;
    } else {
        if (partnerUserId.equals(NOT_ASSIGNED) || partnerUserId < 0)
            return false;
    }
    checkIsMapInitialized();
    CallPartnerView lastView = getPartnerAssignedView(partnerUserId);
    if (lastView != null) {
        lastView.setPartnerId(CallPartnerViewPool.NOT_ASSIGNED);
        lastView.setPartnerName("");
        lastView.setDisplayName(false);
        lastView.setDisplayIsMuteIcon(false);
        lastView.setDisplayCameraIsOffIcon(false);
    }
    Long newViewLastPartnerUserId = newView.getPartnerId();
    if (!newViewLastPartnerUserId.equals(NOT_ASSIGNED)) {
        getValidUserIdToViewMap().remove(newViewLastPartnerUserId);
    }
    visibleView(newView);
    newView.setPartnerId(partnerUserId);
    getValidUserIdToViewMap().put(partnerUserId, newView);
    return true;
}
Also used : 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