From db722badaf9684dd7cc079c885d68405b25278cc Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 29 Sep 2023 17:49:01 +0200 Subject: [PATCH] Disable camera button when call is paused + show Paused / Paused by remote instead of chrono --- .../ui/call/viewmodel/CurrentCallViewModel.kt | 4 ++++ app/src/main/res/layout/call_active_fragment.xml | 12 ++++++++++++ app/src/main/res/layout/call_main_actions.xml | 1 + app/src/main/res/values/strings.xml | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt index 9ed55457f..1dfcaa678 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt @@ -82,6 +82,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() { val isPaused = MutableLiveData() + val isPausedByRemote = MutableLiveData() + val isMicrophoneMuted = MutableLiveData() val isSpeakerEnabled = MutableLiveData() @@ -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() diff --git a/app/src/main/res/layout/call_active_fragment.xml b/app/src/main/res/layout/call_active_fragment.xml index fdf1da575..82b1902ac 100644 --- a/app/src/main/res/layout/call_active_fragment.xml +++ b/app/src/main/res/layout/call_active_fragment.xml @@ -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"/> + + diff --git a/app/src/main/res/layout/call_main_actions.xml b/app/src/main/res/layout/call_main_actions.xml index 50e139829..78ae8476f 100644 --- a/app/src/main/res/layout/call_main_actions.xml +++ b/app/src/main/res/layout/call_main_actions.xml @@ -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 && !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" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 290ac39b4..63351d09d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -201,7 +201,7 @@ Network Use only Wi-Fi networks User interface - User interface + Theme Dark theme Light theme Auto @@ -309,6 +309,7 @@ Incoming Active Paused + Paused by remote Resuming… Ended Calls list