rename variables and methods

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-11-12 12:01:56 +01:00
parent 37c3f35f7a
commit 79a8c16758
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 27 additions and 22 deletions

View File

@ -680,7 +680,7 @@ class CallActivity : CallBaseActivity() {
} else { } else {
if (isModerator) { if (isModerator) {
binding!!.hangupButton.setOnLongClickListener { binding!!.hangupButton.setOnLongClickListener {
showEndCallPopupMenu() showEndCallForAllPopupMenu()
true true
} }
} }
@ -690,14 +690,14 @@ class CallActivity : CallBaseActivity() {
} }
if (!isOneToOneConversation) { if (!isOneToOneConversation) {
binding!!.popupMenu.setOnClickListener { binding!!.endCallPopupMenu.setOnClickListener {
hangup(true, true) hangup(true, true)
binding!!.popupMenu.visibility = View.GONE binding!!.endCallPopupMenu.visibility = View.GONE
} }
} else { } else {
binding!!.popupMenu.setOnClickListener { binding!!.endCallPopupMenu.setOnClickListener {
hangup(true, false) hangup(true, false)
binding!!.popupMenu.visibility = View.GONE binding!!.endCallPopupMenu.visibility = View.GONE
} }
} }
@ -736,14 +736,14 @@ class CallActivity : CallBaseActivity() {
binding!!.lowerHandButton.setOnClickListener { l: View? -> raiseHandViewModel!!.lowerHand() } binding!!.lowerHandButton.setOnClickListener { l: View? -> raiseHandViewModel!!.lowerHand() }
} }
private fun showEndCallPopupMenu() { private fun showEndCallForAllPopupMenu() {
binding!!.popupMenu.visibility = View.VISIBLE binding!!.endCallPopupMenu.visibility = View.VISIBLE
binding!!.popupMenu.text = context.getString(R.string.end_call_for_everyone) binding!!.endCallPopupMenu.text = context.getString(R.string.end_call_for_everyone)
} }
private fun showLeaveCallPopupMenu() { private fun showLeaveCallPopupMenu() {
binding!!.popupMenu.visibility = View.VISIBLE binding!!.endCallPopupMenu.visibility = View.VISIBLE
binding!!.popupMenu.text = context.getString(R.string.leave_call) binding!!.endCallPopupMenu.text = context.getString(R.string.leave_call)
} }
private fun createCameraEnumerator() { private fun createCameraEnumerator() {
@ -894,7 +894,7 @@ class CallActivity : CallBaseActivity() {
val action = me.actionMasked val action = me.actionMasked
if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) {
animateCallControls(true, 0) animateCallControls(true, 0)
binding!!.popupMenu.visibility = View.GONE binding!!.endCallPopupMenu.visibility = View.GONE
} }
false false
} }
@ -902,7 +902,7 @@ class CallActivity : CallBaseActivity() {
val action = me.actionMasked val action = me.actionMasked
if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) {
animateCallControls(true, 0) animateCallControls(true, 0)
binding!!.popupMenu.visibility = View.GONE binding!!.endCallPopupMenu.visibility = View.GONE
} }
false false
} }
@ -1795,7 +1795,8 @@ class CallActivity : CallBaseActivity() {
private fun startCallTimeCounter(callStartTime: Long) { private fun startCallTimeCounter(callStartTime: Long) {
if (callStartTime != 0L && if (callStartTime != 0L &&
hasSpreedFeatureCapability( hasSpreedFeatureCapability(
conversationUser!!.capabilities!!.spreedCapability!!, SpreedFeatures.RECORDING_V1 conversationUser!!.capabilities!!.spreedCapability!!,
SpreedFeatures.RECORDING_V1
) )
) { ) {
binding!!.callDuration.visibility = View.VISIBLE binding!!.callDuration.visibility = View.VISIBLE
@ -2239,8 +2240,10 @@ class CallActivity : CallBaseActivity() {
// remote session ID. However, if the other participant does not have audio nor video that participant // remote session ID. However, if the other participant does not have audio nor video that participant
// will not send an offer, so no connection is actually established when the remote participant has a // will not send an offer, so no connection is actually established when the remote participant has a
// higher session ID but is not publishing media. // higher session ID but is not publishing media.
if (hasMCU && participantHasAudioOrVideo || if (hasMCU &&
!hasMCU && selfParticipantHasAudioOrVideo && participantHasAudioOrVideo ||
!hasMCU &&
selfParticipantHasAudioOrVideo &&
(!participantHasAudioOrVideo || sessionId < currentSessionId!!) (!participantHasAudioOrVideo || sessionId < currentSessionId!!)
) { ) {
getOrCreatePeerConnectionWrapperForSessionIdAndType(sessionId, VIDEO_STREAM_TYPE_VIDEO, false) getOrCreatePeerConnectionWrapperForSessionIdAndType(sessionId, VIDEO_STREAM_TYPE_VIDEO, false)
@ -2263,15 +2266,14 @@ class CallActivity : CallBaseActivity() {
} }
} }
private fun participantInCallFlagsHaveAudioOrVideo(participant: Participant?): Boolean { private fun participantInCallFlagsHaveAudioOrVideo(participant: Participant?): Boolean =
return if (participant == null) { if (participant == null) {
false false
} else { } else {
participant.inCall and Participant.InCallFlags.WITH_AUDIO.toLong() > 0 || participant.inCall and Participant.InCallFlags.WITH_AUDIO.toLong() > 0 ||
!isVoiceOnlyCall && !isVoiceOnlyCall &&
participant.inCall and Participant.InCallFlags.WITH_VIDEO.toLong() > 0 participant.inCall and Participant.InCallFlags.WITH_VIDEO.toLong() > 0
} }
}
private fun getPeerConnectionWrapperForSessionIdAndType(sessionId: String?, type: String): PeerConnectionWrapper? { private fun getPeerConnectionWrapperForSessionIdAndType(sessionId: String?, type: String): PeerConnectionWrapper? {
for (wrapper in peerConnectionWrapperList) { for (wrapper in peerConnectionWrapperList) {
@ -2519,10 +2521,12 @@ class CallActivity : CallBaseActivity() {
fun onMessageEvent(proximitySensorEvent: ProximitySensorEvent) { fun onMessageEvent(proximitySensorEvent: ProximitySensorEvent) {
if (!isVoiceOnlyCall) { if (!isVoiceOnlyCall) {
val enableVideo = proximitySensorEvent.proximitySensorEventType == val enableVideo = proximitySensorEvent.proximitySensorEventType ==
ProximitySensorEvent.ProximitySensorEventType.SENSOR_FAR && videoOn ProximitySensorEvent.ProximitySensorEventType.SENSOR_FAR &&
videoOn
if (permissionUtil!!.isCameraPermissionGranted() && if (permissionUtil!!.isCameraPermissionGranted() &&
(currentCallStatus === CallStatus.CONNECTING || isConnectionEstablished) && (currentCallStatus === CallStatus.CONNECTING || isConnectionEstablished) &&
videoOn && enableVideo != localVideoTrack!!.enabled() videoOn &&
enableVideo != localVideoTrack!!.enabled()
) { ) {
toggleMedia(enableVideo, true) toggleMedia(enableVideo, true)
} }
@ -3156,7 +3160,8 @@ class CallActivity : CallBaseActivity() {
get() = hasSpreedFeatureCapability( get() = hasSpreedFeatureCapability(
conversationUser.capabilities!!.spreedCapability!!, conversationUser.capabilities!!.spreedCapability!!,
SpreedFeatures.RAISE_HAND SpreedFeatures.RAISE_HAND
) || isBreakoutRoom ) ||
isBreakoutRoom
private inner class SelfVideoTouchListener : OnTouchListener { private inner class SelfVideoTouchListener : OnTouchListener {
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")

View File

@ -196,7 +196,7 @@
app:alignItems="center"> app:alignItems="center">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/popup_menu" android:id="@+id/end_call_popup_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"