Search in sources :

Example 1 with CallPartnerView

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

the class CallPresenter method onCallParticipantJoined.

@Override
public void onCallParticipantJoined(ChatResponse<JoinCallParticipantResult> response) {
    for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
        try {
            activity.runOnUiThread(() -> {
                if (cpvManager != null) {
                    cpvManager.showPartnerName(callParticipant.getUserId(), callParticipant.getParticipantVO().getName());
                    return;
                }
                CallPartnerView pw = findParticipantView(callParticipant.getUserId());
                pw.setDisplayName(true);
                pw.setPartnerName(callParticipant.getParticipantVO().getName());
            });
        } catch (Exception exc) {
            exc.printStackTrace();
        }
        view.showMessage(callParticipant.getParticipantVO().getName() + " وارد تماس شد!");
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 2 with CallPartnerView

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

the class CallActivity method init.

private void init() {
    viewSwitcherRecentCalls = findViewById(R.id.viewSwitcherRecentCalls);
    presenter = new CallPresenter(this, this, this);
    recyclerViewHistory = findViewById(R.id.recyclerViewHistories);
    buttonAddCallParticipant = findViewById(R.id.buttonAddPartner);
    tvStatus = findViewById(R.id.tvStatus);
    tvCallerName = findViewById(R.id.tvCallerName);
    tvCalleeName = findViewById(R.id.tvCalleeName);
    tvHistory = findViewById(R.id.tvHistory);
    tvVersion = findViewById(R.id.tvVersion);
    callRequestView = findViewById(R.id.viewCallRequest);
    inCallView = findViewById(R.id.viewCall);
    viewCallProfileBorder = findViewById(R.id.viewCallerProfileBorder);
    buttonAcceptCall = findViewById(R.id.buttonAccept);
    buttonAcceptWithAudio = findViewById(R.id.buttonAcceptWithAudio);
    buttonRejectCall = findViewById(R.id.buttonReject);
    buttonRejectWithMessage = findViewById(R.id.buttonRejectWithMessage);
    buttonEndCall = findViewById(R.id.buttonEndCall);
    buttonStartCallById = findViewById(R.id.btnSandboxCall);
    buttonStartScreenShare = findViewById(R.id.buttonScreenShare);
    buttonStartCallRecord = findViewById(R.id.buttonStartRecord);
    buttonMute = findViewById(R.id.buttonMute);
    buttonSpeaker = findViewById(R.id.buttonSpeakerOn);
    imgBtnSwitchCamera = findViewById(R.id.imgBtnSwitchCamera);
    imgBtnTurnOnCam = findViewById(R.id.imgBtnTurnOnCam);
    imgBtnTurnOffCam = findViewById(R.id.imgBtnTurnOffCam);
    imgBtnTurnOffIncomingVideos = findViewById(R.id.imgBtnTurnOffIncomingVideos);
    imgBtnTurnOnIncomingVideos = findViewById(R.id.imgBtnTurnOnIncomingVideos);
    etSandboxThreadId = findViewById(R.id.etSandBoxPartnerId);
    frameLayout = findViewById(R.id.frame_call);
    fabContacts = findViewById(R.id.fabShowContactsList);
    fabSetting = findViewById(R.id.fabShowSetting);
    Logger.addLogAdapter(new AndroidLogAdapter());
    imgViewCallerProfile = findViewById(R.id.imgViewCallerProfile);
    imgViewCallerProfileInCall = findViewById(R.id.imgViewCallerProfileInCall);
    localCallPartner = findViewById(R.id.localPartnerCameraView);
    remoteCallPartner1 = findViewById(R.id.remotePartnerView1);
    remoteCallPartner2 = findViewById(R.id.remotePartnerView2);
    remoteCallPartner3 = findViewById(R.id.remotePartnerView3);
    remoteCallPartner4 = findViewById(R.id.remotePartnerView4);
    constraintHolder = findViewById(R.id.constraintHolder);
    List<CallPartnerView> views = new ArrayList<>();
    views.add(remoteCallPartner1);
    if (!CALL_PARTNER_VIEW_AUTO_GENERATE_TEST) {
        views.add(remoteCallPartner2);
        views.add(remoteCallPartner3);
        views.add(remoteCallPartner4);
    }
    presenter.setupVideoCallParam(localCallPartner, views);
    vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    CallInfo callInfo = getIntent().getParcelableExtra(ChatConstant.POD_CALL_INFO);
    Log.e(TAG, "Call info: " + callInfo);
    if (callInfo != null) {
        presenter.setCallInfo(callInfo);
        showInCallView();
    }
    tvVersion.setText("v" + BuildConfig.VERSION_NAME);
}
Also used : CallInfo(com.fanap.podchat.call.model.CallInfo) AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter) ArrayList(java.util.ArrayList) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 3 with CallPartnerView

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

the class CallPresenter method setNameOnView.

private void setNameOnView(List<CallParticipantVO> callParticipantVOArrayList) {
    try {
        activity.runOnUiThread(() -> {
            for (CallParticipantVO cp : callParticipantVOArrayList) {
                if (cp.hasVideo()) {
                    if (cpvManager != null) {
                        cpvManager.showPartnerName(cp.getUserId(), cp.getParticipantVO().getContactName());
                    } else {
                        CallPartnerView pw = findParticipantView(cp.getUserId());
                        pw.setPartnerName(cp.getParticipantVO().getContactName());
                        pw.setDisplayName(true);
                    }
                }
            }
        });
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 4 with CallPartnerView

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

the class CallPresenter method onCallParticipantUnMuted.

@Override
public void onCallParticipantUnMuted(ChatResponse<MuteUnMuteCallParticipantResult> response) {
    for (CallParticipantVO participant : response.getResult().getCallParticipants()) {
        Long userId = participant.getUserId();
        if (cpvManager != null) {
            activity.runOnUiThread(() -> cpvManager.hideMuteIcon(userId));
        } else {
            CallPartnerView partnerView = null;
            if (userId != null) {
                partnerView = findParticipantView(userId);
            }
            String name = Util.isNotNullOrEmpty(participant.getParticipantVO().getContactName()) ? participant.getParticipantVO().getContactName() : participant.getParticipantVO().getName();
            view.showMessage(name + " میکروفنش رو باز کرد 😍");
            view.callParticipantUnMuted(participant, partnerView);
        }
    }
}
Also used : CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 5 with CallPartnerView

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

the class CallPresenter method onCallParticipantMuted.

@Override
public void onCallParticipantMuted(ChatResponse<MuteUnMuteCallParticipantResult> response) {
    for (CallParticipantVO participant : response.getResult().getCallParticipants()) {
        Long userId = participant.getUserId();
        if (cpvManager != null) {
            activity.runOnUiThread(() -> cpvManager.showMuteIcon(userId));
        } else {
            CallPartnerView partnerView = null;
            if (userId != null) {
                partnerView = findParticipantView(userId);
            }
            String name = Util.isNotNullOrEmpty(participant.getParticipantVO().getContactName()) ? participant.getParticipantVO().getContactName() : participant.getParticipantVO().getName();
            view.showMessage(name + " میکروفنش رو بست 🤐");
            view.callParticipantMuted(participant, partnerView);
        }
    }
}
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