Leave start call fragment after successful call && updated name group call / conversation dialog to stay at top of screen

This commit is contained in:
Sylvain Berfini 2024-06-24 14:44:09 +02:00
parent 515b645b89
commit af6cfdfc18
3 changed files with 22 additions and 1 deletions

View file

@ -39,6 +39,7 @@ import org.linphone.ui.main.fragment.GenericAddressPickerFragment
import org.linphone.ui.main.fragment.GroupSetOrEditSubjectDialogModel
import org.linphone.ui.main.history.viewmodel.StartCallViewModel
import org.linphone.utils.DialogUtils
import org.linphone.utils.Event
import org.linphone.utils.addCharacterAtPosition
import org.linphone.utils.hideKeyboard
import org.linphone.utils.removeCharacterAtPosition
@ -104,6 +105,12 @@ class StartCallFragment : GenericAddressPickerFragment() {
}
}
viewModel.leaveFragmentEvent.observe(viewLifecycleOwner) {
it.consume {
goBack()
}
}
viewModel.removedCharacterAtCurrentPositionEvent.observe(viewLifecycleOwner) {
it.consume {
binding.searchBar.removeCharacterAtPosition()
@ -159,6 +166,7 @@ class StartCallFragment : GenericAddressPickerFragment() {
@WorkerThread
override fun onSingleAddressSelected(address: Address, friend: Friend) {
coreContext.startAudioCall(address)
viewModel.leaveFragmentEvent.postValue(Event(true))
}
override fun onPause() {

View file

@ -74,6 +74,10 @@ class StartCallViewModel @UiThread constructor() : AddressSelectionViewModel() {
MutableLiveData<Event<Boolean>>()
}
val leaveFragmentEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private val conferenceSchedulerListener = object : ConferenceSchedulerListenerStub() {
override fun onStateChanged(
conferenceScheduler: ConferenceScheduler,
@ -89,6 +93,7 @@ class StartCallViewModel @UiThread constructor() : AddressSelectionViewModel() {
"$TAG Conference info created, address is ${conferenceAddress.asStringUriOnly()}"
)
coreContext.startVideoCall(conferenceAddress)
leaveFragmentEvent.postValue(Event(true))
} else {
Log.e("$TAG Conference info URI is null!")
showRedToastEvent.postValue(
@ -142,6 +147,7 @@ class StartCallViewModel @UiThread constructor() : AddressSelectionViewModel() {
if (address != null) {
Log.i("$TAG Calling [${address.asStringUriOnly()}]")
coreContext.startAudioCall(address)
leaveFragmentEvent.postValue(Event(true))
} else {
Log.e("$TAG Failed to parse [$suggestion] as SIP address")
}

View file

@ -16,6 +16,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/half_screen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.50" />
<ImageView
android:id="@+id/dialog_background"
android:layout_width="0dp"
@ -106,7 +113,7 @@
app:layout_constraintTop_toBottomOf="@id/confirm"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintBottom_toBottomOf="@id/half_screen"/>
</androidx.constraintlayout.widget.ConstraintLayout>