Disable video toggle button and show indeterminate spinner while re-INVITE is in progress

This commit is contained in:
Sylvain Berfini 2024-12-23 20:04:05 +01:00
parent d0dc42c67b
commit b084807d18
2 changed files with 17 additions and 1 deletions

View file

@ -85,6 +85,8 @@ class CurrentCallViewModel
val showSwitchCamera = MutableLiveData<Boolean>()
val videoUpdateInProgress = MutableLiveData<Boolean>()
val isOutgoing = MutableLiveData<Boolean>()
val isOutgoingRinging = MutableLiveData<Boolean>()
@ -361,6 +363,7 @@ class CurrentCallViewModel
conferenceModel.destroy()
}
} else if (call.state == Call.State.StreamsRunning) {
videoUpdateInProgress.postValue(false)
updateCallDuration()
if (corePreferences.automaticallyStartCallRecording) {
isRecording.postValue(call.params.isRecording)
@ -533,6 +536,7 @@ class CurrentCallViewModel
fullScreenMode.value = false
operationInProgress.value = false
proximitySensorEnabled.value = false
videoUpdateInProgress.value = false
coreContext.postOnCoreThread { core ->
coreContext.contactsManager.addListener(contactsListener)
@ -831,6 +835,7 @@ class CurrentCallViewModel
)
}
currentCall.update(params)
videoUpdateInProgress.postValue(true)
}
}
}

View file

@ -52,7 +52,7 @@
android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="16dp"
android:padding="@dimen/call_button_icon_padding"
android:enabled="@{!viewModel.isPaused &amp;&amp; !viewModel.isPausedByRemote}"
android:enabled="@{!viewModel.isPaused &amp;&amp; !viewModel.isPausedByRemote &amp;&amp; !viewModel.videoUpdateInProgress}"
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
android:src="@{viewModel.isSendingVideo ? @drawable/video_camera : @drawable/video_camera_slash, default=@drawable/video_camera}"
android:background="@drawable/in_call_button_background_red"
@ -65,6 +65,17 @@
app:layout_constraintStart_toEndOf="@id/hang_up"
app:layout_constraintEnd_toStartOf="@id/toggle_mute_mic" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/video_update_in_progress"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="@{viewModel.videoUpdateInProgress ? View.VISIBLE : View.GONE}"
android:indeterminate="true"
app:layout_constraintTop_toTopOf="@id/toggle_video"
app:layout_constraintBottom_toBottomOf="@id/toggle_video"
app:layout_constraintStart_toStartOf="@id/toggle_video"
app:layout_constraintEnd_toEndOf="@id/toggle_video"/>
<ImageView
android:onClick="@{() -> viewModel.toggleMuteMicrophone()}"
android:id="@+id/toggle_mute_mic"