Show who terminated a call in fragment title

This commit is contained in:
Sylvain Berfini 2025-02-03 16:44:28 +01:00
parent 00a7d34509
commit 63051ae58e
6 changed files with 10 additions and 58 deletions

View file

@ -20,7 +20,6 @@
package org.linphone.ui.call.fragment
import android.os.Bundle
import android.os.SystemClock
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -73,11 +72,6 @@ class EndedCallFragment : GenericCallFragment() {
binding.viewModel = callViewModel
Log.i("$TAG Showing ended call fragment")
callViewModel.callDuration.observe(viewLifecycleOwner) { duration ->
binding.chronometer.base = SystemClock.elapsedRealtime() - (1000 * duration)
binding.chronometer.stop() // Do not start it and make sure it is stopped
}
}
override fun onResume() {
@ -85,7 +79,7 @@ class EndedCallFragment : GenericCallFragment() {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
if (callViewModel.terminatedByUsed) {
if (callViewModel.terminatedByUser) {
Log.i(
"$TAG Call terminated by user, waiting 1 second before finishing activity"
)

View file

@ -143,7 +143,7 @@ class CurrentCallViewModel
val qualityIcon = MutableLiveData<Int>()
var terminatedByUsed = false
var terminatedByUser = false
val isRemoteRecordingEvent: MutableLiveData<Event<Pair<Boolean, String>>> by lazy {
MutableLiveData<Event<Pair<Boolean, String>>>()
@ -616,7 +616,7 @@ class CurrentCallViewModel
coreContext.postOnCoreThread {
if (::currentCall.isInitialized) {
Log.i("$TAG Terminating call [${currentCall.remoteAddress.asStringUriOnly()}]")
terminatedByUsed = true
terminatedByUser = true
coreContext.terminateCall(currentCall)
}
}
@ -1060,7 +1060,7 @@ class CurrentCallViewModel
)
contact.value?.destroy()
terminatedByUsed = false
terminatedByUser = false
currentCall = call
callStatsModel.update(call, call.audioStats)
callMediaEncryptionModel.update(call)

View file

@ -33,33 +33,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/call_ended"
android:text="@{viewModel.terminatedByUser ? @string/call_locally_ended : @string/call_remotely_ended, default=@string/call_locally_ended}"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/back"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/call_header_style"
android:id="@+id/separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/vertical_separator"
app:layout_constraintStart_toEndOf="@id/call_direction_label"
app:layout_constraintTop_toTopOf="@id/call_direction_label"
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
<Chronometer
style="@style/call_header_style"
android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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"
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
<include
android:id="@+id/call_media_encryption_info"
android:layout_width="0dp"

View file

@ -33,33 +33,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/call_ended"
android:text="@{viewModel.terminatedByUser ? @string/call_locally_ended : @string/call_remotely_ended, default=@string/call_locally_ended}"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintBottom_toBottomOf="@id/back"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/call_header_style"
android:id="@+id/separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/vertical_separator"
app:layout_constraintStart_toEndOf="@id/call_direction_label"
app:layout_constraintTop_toTopOf="@id/call_direction_label"
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
<Chronometer
style="@style/call_header_style"
android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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"
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
<include
android:id="@+id/call_media_encryption_info"
android:layout_width="0dp"

View file

@ -599,7 +599,8 @@
<string name="call_outgoing">Appel sortant</string>
<string name="call_audio_incoming">Appel entrant</string>
<string name="call_video_incoming">Appel vidéo entrant</string>
<string name="call_ended">Appel terminé</string>
<string name="call_locally_ended">Vous avez terminé l\'appel</string>
<string name="call_remotely_ended">Votre correspondant a terminé l\'appel</string>
<string name="call_audio_incoming_for_account">Appel entrant pour %s</string>
<string name="call_video_incoming_for_account">Appel vidéo entrant pour %s</string>
<string name="call_transfer_current_call_title">Transférer %s à…</string>

View file

@ -639,7 +639,8 @@
<string name="call_outgoing">Outgoing call</string>
<string name="call_audio_incoming">Incoming call</string>
<string name="call_video_incoming">Incoming video call</string>
<string name="call_ended">Call ended</string>
<string name="call_locally_ended">You have ended the call</string>
<string name="call_remotely_ended">Correspondent has ended the call</string>
<string name="call_audio_incoming_for_account">Incoming call for %s</string>
<string name="call_video_incoming_for_account">Incoming video call for %s</string>
<string name="call_transfer_current_call_title">Transfer %s to…</string>