Disable change audio output device until call is in Ringing state

This commit is contained in:
Sylvain Berfini 2024-04-25 09:36:07 +02:00
parent 2070f8fb08
commit 84f7af8d13
3 changed files with 10 additions and 4 deletions

View file

@ -84,6 +84,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val isOutgoing = MutableLiveData<Boolean>()
val isOutgoingRinging = MutableLiveData<Boolean>()
val isRecordingEnabled = MutableLiveData<Boolean>()
val isRecording = MutableLiveData<Boolean>()
@ -341,6 +343,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
state: Call.State,
message: String
) {
isOutgoingRinging.postValue(call.state == Call.State.OutgoingRinging)
if (::currentCall.isInitialized) {
if (call != currentCall) {
if (call == currentCall.core.currentCall) {
@ -996,6 +1000,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
updateOutputAudioDevice(audioDevice)
isOutgoing.postValue(call.dir == Call.Dir.Outgoing)
isOutgoingRinging.postValue(call.state == Call.State.OutgoingRinging)
isPaused.postValue(isCallPaused())
isPausedByRemote.postValue(call.state == Call.State.PausedByRemote)

View file

@ -40,7 +40,7 @@
android:src="@drawable/video_camera_slash"
android:background="@drawable/shape_round_in_call_disabled_button_background"
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
app:tint="?attr/color_grey_500"
app:tint="@color/gray_400"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintBottom_toBottomOf="parent"
@ -55,7 +55,7 @@
android:padding="@dimen/call_button_icon_padding"
android:src="@drawable/microphone_slash"
android:background="@drawable/shape_round_in_call_disabled_button_background"
app:tint="?attr/color_grey_500"
app:tint="@color/gray_400"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/toggle_video"
app:layout_constraintEnd_toStartOf="@id/change_audio_output" />
@ -68,7 +68,7 @@
android:padding="@dimen/call_button_icon_padding"
android:src="@drawable/speaker_slash"
android:background="@drawable/shape_round_in_call_disabled_button_background"
app:tint="?attr/color_grey_500"
app:tint="@color/gray_400"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/toggle_mute_mic"
app:layout_constraintEnd_toEndOf="parent" />

View file

@ -40,7 +40,7 @@
android:visibility="@{viewModel.hideVideo ? View.GONE : View.VISIBLE}"
android:src="@{viewModel.isVideoEnabled ? @drawable/video_camera : @drawable/video_camera_slash, default=@drawable/video_camera}"
android:background="@drawable/shape_round_in_call_disabled_button_background"
app:tint="@color/gray_500"
app:tint="@color/gray_400"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintBottom_toBottomOf="parent"
@ -68,6 +68,7 @@
android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="16dp"
android:padding="@dimen/call_button_icon_padding"
android:enabled="@{viewModel.isOutgoingRinging}"
android:src="@{viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}"
android:background="@drawable/in_call_button_background_red"
app:tint="@color/in_call_button_tint_color"