Update recording indicator + added remote recording indicator

This commit is contained in:
Sylvain Berfini 2023-09-29 16:00:28 +02:00
parent 62fa5515e1
commit f00c21be91
7 changed files with 55 additions and 36 deletions

View file

@ -283,7 +283,7 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
for (dialPlan in dialPlans) {
dialPlansList.add(dialPlan)
dialPlansLabelList.add(
"${dialPlan.flag} +${dialPlan.countryCallingCode} | ${dialPlan.country}"
"${dialPlan.flag} ${dialPlan.country} | +${dialPlan.countryCallingCode}"
)
}

View file

@ -228,15 +228,6 @@ class ActiveCallFragment : GenericCallFragment() {
}
}
callViewModel.isRecording.observe(viewLifecycleOwner) { recording ->
val text = if (recording) {
getString(R.string.toast_call_recording_started)
} else {
getString(R.string.toast_call_recording_stopped)
}
(requireActivity() as CallActivity).showGreenToast(text, R.drawable.record)
}
actionsBottomSheetBehavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) {

View file

@ -74,6 +74,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
val isRecording = MutableLiveData<Boolean>()
val isRemoteRecording = MutableLiveData<Boolean>()
val isMicrophoneMuted = MutableLiveData<Boolean>()
val isSpeakerEnabled = MutableLiveData<Boolean>()
@ -151,6 +153,11 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
updateEncryption()
}
override fun onRemoteRecording(call: Call, recording: Boolean) {
Log.i("$TAG Remote recording changed: $recording")
isRemoteRecording.postValue(recording)
}
@WorkerThread
override fun onStateChanged(call: Call, state: Call.State, message: String) {
Log.i("$TAG Call [${call.remoteAddress.asStringUriOnly()}] state changed [$state]")
@ -630,10 +637,8 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
isOutgoing.postValue(call.dir == Call.Dir.Outgoing)
if (call.params.isRecording) {
// Do not set it to false to prevent the "no longer recording" toast to be displayed
isRecording.postValue(true)
}
isRecording.postValue(call.params.isRecording)
isRemoteRecording.postValue(call.remoteParams?.isRecording)
val address = call.remoteAddress.clone()
address.clean()

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<size android:width="180dp" android:height="45dp" />
<corners android:topLeftRadius="20dp" android:bottomRightRadius="20dp"/>
<solid android:color="@color/gray_main2_600"/>
</shape>

View file

@ -1,23 +1,12 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="24dp"
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="25dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportWidth="25"
android:viewportHeight="24">
<path
android:name="path"
android:pathData="M 2.5 3 L 21.5 3 L 21.5 16 L 18 20 L 12 21 L 6.5 20 L 2.5 16 L 2.5 3 Z"
android:fillColor="#4aa8ff"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 8.707 9.293 C 8.317 8.902 7.683 8.902 7.293 9.293 C 6.902 9.683 6.902 10.317 7.293 10.707 L 11.293 14.707 C 11.683 15.098 12.317 15.098 12.707 14.707 L 16.707 10.707 C 17.098 10.317 17.098 9.683 16.707 9.293 C 16.317 8.902 15.683 8.902 15.293 9.293 L 12 12.586 L 8.707 9.293 Z"
android:fillColor="#364860"
android:strokeWidth="1"/>
<path
android:name="path_2"
android:pathData="M 20 2 L 4 2 C 3.204 2 2.441 2.316 1.879 2.879 C 1.316 3.441 1 4.204 1 5 L 1 11 C 1 13.917 2.159 16.715 4.222 18.778 C 5.243 19.8 6.456 20.61 7.79 21.163 C 9.125 21.715 10.556 22 12 22 C 14.917 22 17.715 20.841 19.778 18.778 C 21.841 16.715 23 13.917 23 11 L 23 5 C 23 4.204 22.684 3.441 22.121 2.879 C 21.559 2.316 20.796 2 20 2 Z M 3.293 4.293 C 3.48 4.105 3.735 4 4 4 L 20 4 C 20.265 4 20.52 4.105 20.707 4.293 C 20.895 4.48 21 4.735 21 5 L 21 11 C 21 13.387 20.052 15.676 18.364 17.364 C 16.676 19.052 14.387 20 12 20 C 10.818 20 9.648 19.767 8.556 19.315 C 7.464 18.863 6.472 18.2 5.636 17.364 C 3.948 15.676 3 13.387 3 11 L 3 5 C 3 4.735 3.105 4.48 3.293 4.293 Z"
android:fillColor="#364860"
android:strokeWidth="1"/>
<path
android:pathData="M23.5,2.526V9.236C23.5,19.465 14.812,22.859 13.073,23.436C12.701,23.561 12.299,23.561 11.927,23.436C10.185,22.859 1.5,19.465 1.5,9.236V2.526C1.5,2.042 1.693,1.577 2.037,1.235C2.381,0.892 2.847,0.7 3.333,0.7H21.667C22.153,0.7 22.619,0.892 22.963,1.235C23.307,1.577 23.5,2.042 23.5,2.526Z"
android:fillColor="#364860"/>
<path
android:pathData="M20.833,1.6H4.167C3.725,1.6 3.301,1.776 2.988,2.088C2.676,2.401 2.5,2.825 2.5,3.267V9.389C2.5,18.723 10.398,21.82 11.979,22.346C12.317,22.461 12.683,22.461 13.021,22.346C14.604,21.82 22.5,18.723 22.5,9.389V3.267C22.5,2.825 22.324,2.401 22.012,2.088C21.699,1.776 21.275,1.6 20.833,1.6ZM17.256,8.856L11.423,14.69C11.345,14.767 11.254,14.828 11.153,14.87C11.051,14.912 10.943,14.934 10.833,14.934C10.724,14.934 10.615,14.912 10.514,14.87C10.413,14.828 10.321,14.767 10.244,14.69L7.744,12.19C7.587,12.033 7.5,11.821 7.5,11.6C7.5,11.379 7.587,11.167 7.744,11.01C7.9,10.854 8.112,10.766 8.333,10.766C8.554,10.766 8.767,10.854 8.923,11.01L10.833,12.921L16.077,7.677C16.154,7.6 16.246,7.538 16.348,7.496C16.449,7.454 16.557,7.433 16.667,7.433C16.776,7.433 16.885,7.454 16.986,7.496C17.087,7.538 17.179,7.6 17.256,7.677C17.334,7.754 17.395,7.846 17.437,7.948C17.479,8.049 17.5,8.157 17.5,8.267C17.5,8.376 17.479,8.485 17.437,8.586C17.395,8.687 17.334,8.779 17.256,8.856Z"
android:fillColor="#4AA8FF"/>
</vector>

View file

@ -215,6 +215,35 @@
app:layout_constraintHeight_max="200dp"
app:layout_constraintWidth_max="200dp" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:id="@+id/remote_recording"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/call_remote_is_recording"
android:textSize="12sp"
android:textColor="@color/gray_900"
android:gravity="center_vertical"
android:drawableStart="@drawable/record"
android:drawablePadding="10dp"
android:background="@drawable/shape_remote_recording_background"
android:visibility="@{viewModel.isRemoteRecording ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:drawableTint="@color/red_danger_500" />
<ImageView
android:id="@+id/recording"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:src="@drawable/record"
android:visibility="@{viewModel.isRecording ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:tint="@color/red_danger_500" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include

View file

@ -307,11 +307,10 @@
<string name="call_state_ended">Ended</string>
<string name="calls_list_title">Calls list</string>
<string name="call_transfer_title">Transfer call to</string>
<string name="call_remote_is_recording">%s is recording</string>
<string name="toast_call_transfer_in_progress">Call is being transferred to %s</string>
<string name="toast_call_transfer_successful">Call has been transferred to %s</string>
<string name="toast_call_transfer_failed">Call transfer to %s failed!</string>
<string name="toast_call_recording_started">Call is being recorded</string>
<string name="toast_call_recording_stopped">Call is no longer being recorded</string>
<!-- Keep <u></u> in following strings translations! -->
<string name="welcome_carousel_skip"><u>Skip</u></string>