From f019f197de6958f024c9cc1f6e38fb40e3ac90b8 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 3 Apr 2024 08:15:21 +0200 Subject: [PATCH] continue option to disable calls --- .../ui/ConversationFragment.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 79909580d..924931193 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -10,6 +10,7 @@ import java.util.Map; import de.monocles.chat.KeyboardHeightProvider; import de.monocles.chat.WebxdcPage; +import eu.siacs.conversations.entities.Presences; import eu.siacs.conversations.ui.adapter.CommandAdapter; import eu.siacs.conversations.utils.Random; import eu.siacs.conversations.xml.Element; @@ -1738,8 +1739,8 @@ public class ConversationFragment extends XmppFragment final MenuItem menuParticipants = menu.findItem(R.id.action_participants); final MenuItem menuContactDetails = menu.findItem(R.id.action_contact_details); final MenuItem menuCall = menu.findItem(R.id.action_call); - final MenuItem menuDisableCall = menu.findItem(R.id.action_call); - final MenuItem menuEnableCall = menu.findItem(R.id.action_call); + final MenuItem menuDisableCall = menu.findItem(R.id.action_disable_calls); + final MenuItem menuEnableCall = menu.findItem(R.id.action_enable_calls); final MenuItem menuOngoingCall = menu.findItem(R.id.action_ongoing_call); final MenuItem menuVideoCall = menu.findItem(R.id.action_video_call); final MenuItem menuMediaBrowser = menu.findItem(R.id.action_mediabrowser); @@ -1769,16 +1770,23 @@ public class ConversationFragment extends XmppFragment if (ongoingRtpSession.isPresent()) { menuOngoingCall.setVisible(true); menuCall.setVisible(false); - menuDisableCall.setVisible(true); - menuEnableCall.setVisible(false); } else { menuOngoingCall.setVisible(false); final RtpCapability.Capability rtpCapability = RtpCapability.check(conversation.getContact()); final boolean cameraAvailable = activity != null && activity.isCameraFeatureAvailable(); - menuCall.setVisible(rtpCapability != RtpCapability.Capability.NONE); - menuVideoCall.setVisible(rtpCapability == RtpCapability.Capability.VIDEO && cameraAvailable); - menuDisableCall.setVisible(rtpCapability != RtpCapability.Capability.NONE); - menuEnableCall.setVisible(rtpCapability == RtpCapability.Capability.NONE); + if (menuDisableCall.isChecked()) { + final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(activity.xmppConnectionService); + mJingleConnectionManager.isBusy(); + menuDisableCall.setVisible(false); + menuEnableCall.setVisible(true); + menuCall.setVisible(false); + menuVideoCall.setVisible(false); + } else { + menuCall.setVisible(rtpCapability != RtpCapability.Capability.NONE); + menuVideoCall.setVisible(rtpCapability == RtpCapability.Capability.VIDEO && cameraAvailable); + menuDisableCall.setVisible(rtpCapability != RtpCapability.Capability.NONE); + menuEnableCall.setVisible(false); + } } menuParticipants.setVisible(false); menuInviteContact.setVisible(false); @@ -2585,6 +2593,11 @@ public class ConversationFragment extends XmppFragment case R.id.action_refresh_feature_discovery: refreshFeatureDiscovery(); break; + case R.id.action_disable_calls: + final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(activity.xmppConnectionService); + mJingleConnectionManager.isBusy(); + item.setChecked(true); + break; default: break; }