WIP. Send "raise hand"

Building/sending of the signaling message is incomplete for now.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-02-01 19:09:01 +01:00
parent dff37d0a66
commit 49571ca229
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
7 changed files with 100 additions and 0 deletions

View file

@ -210,6 +210,7 @@ public class CallActivity extends CallBaseActivity {
public WebRtcAudioManager audioManager;
public CallRecordingViewModel callRecordingViewModel;
// public RaiseHandViewModel raiseHandViewModel;
private static final String[] PERMISSIONS_CALL = {
Manifest.permission.CAMERA,
@ -1223,6 +1224,25 @@ public class CallActivity extends CallBaseActivity {
}
}
public void clickHand(Boolean raise) {
// TODO: fix how to build&send the message
if (isConnectionEstablished() && peerConnectionWrapperList != null) {
if (!hasMCU) {
for (PeerConnectionWrapper peerConnectionWrapper : peerConnectionWrapperList) {
peerConnectionWrapper.raiseHand(raise);
}
} else {
for (PeerConnectionWrapper peerConnectionWrapper : peerConnectionWrapperList) {
if (peerConnectionWrapper.getSessionId().equals(webSocketClient.getSessionId())) {
peerConnectionWrapper.raiseHand(raise);
break;
}
}
}
}
}
private void animateCallControls(boolean show, long startDelay) {
if (isVoiceOnlyCall) {
@ -3042,6 +3062,10 @@ public class CallActivity extends CallBaseActivity {
&& isModerator;
}
public boolean isAllowedToRaiseHand() {
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "raise-hand");
}
private class SelfVideoTouchListener implements View.OnTouchListener {
@SuppressLint("ClickableViewAccessibility")

View file

@ -72,12 +72,23 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
} else {
binding.recordCall.visibility = View.GONE
}
if (callActivity.isAllowedToRaiseHand) {
binding.raiseHand.visibility = View.VISIBLE
} else {
binding.raiseHand.visibility = View.GONE
}
}
private fun initClickListeners() {
binding.recordCall.setOnClickListener {
callActivity.callRecordingViewModel.clickRecordButton()
}
binding.raiseHand.setOnClickListener {
// TODO: save raised hand state & toggle...
callActivity.clickHand(true)
}
}
private fun initObservers() {

View file

@ -190,6 +190,26 @@ public class PeerConnectionWrapper {
}
}
public void raiseHand(Boolean raise) {
// TODO: fix how to build&send the message
NCMessagePayload ncMessagePayload = new NCMessagePayload();
ncMessagePayload.setState(raise);
ncMessagePayload.setTimestamp(System.currentTimeMillis());
NCSignalingMessage ncSignalingMessage = new NCSignalingMessage();
// ncSignalingMessage.setFrom();
ncSignalingMessage.setTo(sessionId);
// ncSignalingMessage.setSid();
ncSignalingMessage.setType("raiseHand");
ncSignalingMessage.setPayload(ncMessagePayload);
ncSignalingMessage.setRoomType(videoStreamType);
signalingMessageSender.send(ncSignalingMessage);
}
/**
* Adds a listener for data channel messages.
*

View file

@ -0,0 +1,5 @@
<vector android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M13,24c-3.26,0 -6.19,-1.99 -7.4,-5.02l-3.03,-7.61C2.26,10.58 3,9.79 3.81,10.05l0.79,0.26c0.56,0.18 1.02,0.61 1.24,1.16L7.25,15H8V3.25C8,2.56 8.56,2 9.25,2s1.25,0.56 1.25,1.25V12h1V1.25C11.5,0.56 12.06,0 12.75,0S14,0.56 14,1.25V12h1V2.75c0,-0.69 0.56,-1.25 1.25,-1.25c0.69,0 1.25,0.56 1.25,1.25V12h1V5.75c0,-0.69 0.56,-1.25 1.25,-1.25S21,5.06 21,5.75V16C21,20.42 17.42,24 13,24z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M13,10.17l-2.5,-2.5V2.25C10.5,1.56 11.06,1 11.75,1S13,1.56 13,2.25V10.17zM20,12.75V11V5.25C20,4.56 19.44,4 18.75,4S17.5,4.56 17.5,5.25V11h-1V3.25C16.5,2.56 15.94,2 15.25,2S14,2.56 14,3.25v7.92l6,6V12.75zM9.5,4.25C9.5,3.56 8.94,3 8.25,3c-0.67,0 -1.2,0.53 -1.24,1.18L9.5,6.67V4.25zM13,10.17l-2.5,-2.5V2.25C10.5,1.56 11.06,1 11.75,1S13,1.56 13,2.25V10.17zM20,12.75V11V5.25C20,4.56 19.44,4 18.75,4S17.5,4.56 17.5,5.25V11h-1V3.25C16.5,2.56 15.94,2 15.25,2S14,2.56 14,3.25v7.92l6,6V12.75zM9.5,4.25C9.5,3.56 8.94,3 8.25,3c-0.67,0 -1.2,0.53 -1.24,1.18L9.5,6.67V4.25zM21.19,21.19L2.81,2.81L1.39,4.22l5.63,5.63L7,9.83v4.3c-1.11,-0.64 -2.58,-1.47 -2.6,-1.48c-0.17,-0.09 -0.34,-0.14 -0.54,-0.14c-0.26,0 -0.5,0.09 -0.7,0.26C3.12,12.78 2,13.88 2,13.88l6.8,7.18c0.57,0.6 1.35,0.94 2.18,0.94H17c0.62,0 1.18,-0.19 1.65,-0.52l-0.02,-0.02l1.15,1.15L21.19,21.19z"/>
</vector>

View file

@ -37,6 +37,39 @@
android:textColor="@color/medium_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
<LinearLayout
android:id="@+id/raise_hand"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="@dimen/standard_padding"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/raise_hand_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_hand_back_left"
app:tint="@color/high_emphasis_menu_icon_inverse" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/raise_hand_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_call_raise_hand_description"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/record_call"
android:layout_width="match_parent"

View file

@ -223,6 +223,8 @@
<string name="nc_call_button_content_description_answer_video_call">Answer as video call</string>
<string name="nc_call_button_content_description_switch_to_self_vide">Switch to self video</string>
<string name="nc_call_raised_hand">%1$s raised the hand</string>
<string name="nc_call_raise_hand_description">Raise hand</string>
<string name="nc_call_lower_hand_description">Lower hand</string>
<!-- Picture in Picture -->
<string name="nc_pip_microphone_mute">Mute microphone</string>