Disable camera button when call is paused + show Paused / Paused by remote instead of chrono

This commit is contained in:
Sylvain Berfini 2023-09-29 17:49:01 +02:00
parent e6387e124f
commit db722badaf
4 changed files with 19 additions and 1 deletions

View file

@ -82,6 +82,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val isPaused = MutableLiveData<Boolean>()
val isPausedByRemote = MutableLiveData<Boolean>()
val isMicrophoneMuted = MutableLiveData<Boolean>()
val isSpeakerEnabled = MutableLiveData<Boolean>()
@ -213,6 +215,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
}
isPaused.postValue(isCallPaused())
isPausedByRemote.postValue(call.state == Call.State.PausedByRemote)
canBePaused.postValue(canCallBePaused())
}
@ -673,6 +676,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
isOutgoing.postValue(call.dir == Call.Dir.Outgoing)
isPaused.postValue(isCallPaused())
isPausedByRemote.postValue(call.state == Call.State.PausedByRemote)
canBePaused.postValue(canCallBePaused())
val address = call.remoteAddress.clone()

View file

@ -184,6 +184,18 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/call_top_bar_text_height"
android:layout_marginStart="5dp"
android:visibility="@{viewModel.isPaused || viewModel.isPausedByRemote ? View.GONE : View.VISIBLE}"
app:layout_constraintStart_toEndOf="@id/separator"
app:layout_constraintTop_toTopOf="@id/call_direction_label"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/call_header_style"
android:id="@+id/paused_call_header"
android:layout_width="wrap_content"
android:layout_height="@dimen/call_top_bar_text_height"
android:layout_marginStart="5dp"
android:text="@{viewModel.isPaused ? @string/call_state_paused : @string/call_state_paused_by_remote, default=@string/call_state_paused}"
android:visibility="@{viewModel.isPaused || viewModel.isPausedByRemote ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintStart_toEndOf="@id/separator"
app:layout_constraintTop_toTopOf="@id/call_direction_label"/>

View file

@ -53,6 +53,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:src="@{viewModel.isVideoEnabled() ? @drawable/video_camera : @drawable/video_camera_slash, default=@drawable/video_camera}"
android:background="@drawable/in_call_button_background"
app:tint="@color/in_call_button_tint_color"

View file

@ -201,7 +201,7 @@
<string name="settings_network_title">Network</string>
<string name="settings_network_use_wifi_only">Use only Wi-Fi networks</string>
<string name="settings_user_interface_title">User interface</string>
<string name="settings_user_interface_theme_title">User interface</string>
<string name="settings_user_interface_theme_title">Theme</string>
<string name="settings_user_interface_dark_theme_label">Dark theme</string>
<string name="settings_user_interface_light_theme_label">Light theme</string>
<string name="settings_user_interface_auto_theme_label">Auto</string>
@ -309,6 +309,7 @@
<string name="call_state_incoming_received">Incoming</string>
<string name="call_state_connected">Active</string>
<string name="call_state_paused">Paused</string>
<string name="call_state_paused_by_remote">Paused by remote</string>
<string name="call_state_resuming">Resuming…</string>
<string name="call_state_ended">Ended</string>
<string name="calls_list_title">Calls list</string>