Improved incoming call fragment layout when early media with video

This commit is contained in:
Sylvain Berfini 2023-01-27 10:54:22 +01:00
parent 31f3cb3391
commit 382805ddeb
2 changed files with 47 additions and 3 deletions

View file

@ -55,6 +55,8 @@ class ControlsViewModel : ViewModel() {
val isOutgoingEarlyMedia = MutableLiveData<Boolean>()
val isIncomingEarlyMediaVideo = MutableLiveData<Boolean>()
val showExtras = MutableLiveData<Boolean>()
val fullScreenMode = MutableLiveData<Boolean>()
@ -113,8 +115,9 @@ class ControlsViewModel : ViewModel() {
message: String
) {
Log.i("[Call Controls] State changed: $state")
isOutgoingEarlyMedia.value = state == Call.State.OutgoingEarlyMedia
isIncomingEarlyMediaVideo.value = state == Call.State.IncomingEarlyMedia && call.remoteParams?.isVideoEnabled == true
if (state == Call.State.StreamsRunning) {
if (!call.currentParams.isVideoEnabled && fullScreenMode.value == true) {
fullScreenMode.value = false
@ -213,6 +216,12 @@ class ControlsViewModel : ViewModel() {
proximitySensorEnabled.value = shouldProximitySensorBeEnabled()
}
val currentCall = coreContext.core.currentCall ?: coreContext.core.calls.firstOrNull()
val state = currentCall?.state ?: Call.State.Idle
Log.i("[Call Controls] Current state is: $state")
isOutgoingEarlyMedia.value = state == Call.State.OutgoingEarlyMedia
isIncomingEarlyMediaVideo.value = state == Call.State.IncomingEarlyMedia && currentCall?.remoteParams?.isVideoEnabled == true
updateUI()
if (corePreferences.enableAnimations) bounceAnimator.start()

View file

@ -53,6 +53,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:visibility="@{callsViewModel.currentCallData.isConferenceCall ? View.GONE : View.VISIBLE, default=visible}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/incoming_call_title" />
@ -180,12 +181,39 @@
</androidx.core.widget.NestedScrollView>
<TextView
android:id="@+id/early_media_caller_name"
style="@style/call_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@{callsViewModel.currentCallData.contact.name ?? callsViewModel.currentCallData.displayName, default=`Bilbo Baggins`}"
app:layout_constraintBottom_toTopOf="@id/early_media_sipAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/early_media_sipAddress"
style="@style/call_header_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="@{callsViewModel.currentCallData.displayableAddress, default=`sip:bilbo.baggins@sip.linphone.org`}"
app:layout_constraintBottom_toTopOf="@id/buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/single_call_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{callsViewModel.currentCallData.isConferenceCall ? View.GONE : View.VISIBLE, default=visible}"
app:constraint_referenced_ids="incoming_call_timer, avatar, caller_name, sipAddress" />
android:visibility="@{callsViewModel.currentCallData.isConferenceCall || controlsViewModel.isIncomingEarlyMediaVideo ? View.GONE : View.VISIBLE, default=visible}"
app:constraint_referenced_ids="avatar, caller_name, sipAddress" />
<androidx.constraintlayout.widget.Group
android:id="@+id/conference_group"
@ -194,6 +222,13 @@
android:visibility="@{callsViewModel.currentCallData.isConferenceCall ? View.VISIBLE : View.GONE, default=gone}"
app:constraint_referenced_ids="incoming_conference_subject, conference_avatar, participants_count, participants_list" />
<androidx.constraintlayout.widget.Group
android:id="@+id/single_call_early_media_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{controlsViewModel.isIncomingEarlyMediaVideo ? View.VISIBLE : View.GONE, default=gone}"
app:constraint_referenced_ids="early_media_caller_name, early_media_sipAddress" />
<include
android:id="@+id/buttons"
layout="@layout/voip_buttons_incoming"