diff --git a/app/src/main/java/org/linphone/ui/call/CallActivity.kt b/app/src/main/java/org/linphone/ui/call/CallActivity.kt index c6ce254f6..61242f8a4 100644 --- a/app/src/main/java/org/linphone/ui/call/CallActivity.kt +++ b/app/src/main/java/org/linphone/ui/call/CallActivity.kt @@ -97,6 +97,7 @@ class CallActivity : AppCompatActivity() { callsViewModel = run { ViewModelProvider(this)[CallsViewModel::class.java] } + binding.callsViewModel = callsViewModel callViewModel = run { ViewModelProvider(this)[CurrentCallViewModel::class.java] diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CallsViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CallsViewModel.kt index 6e68153d0..981f86db8 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CallsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CallsViewModel.kt @@ -88,6 +88,7 @@ class CallsViewModel @UiThread constructor() : ViewModel() { list.add(model) calls.postValue(list) callsCount.postValue(list.size) + Log.i("$TAG There is [${list.size}] calls at this time") } } else { if (state == Call.State.End || state == Call.State.Released || state == Call.State.Error) { @@ -99,10 +100,13 @@ class CallsViewModel @UiThread constructor() : ViewModel() { list.remove(found) calls.postValue(list) callsCount.postValue(list.size) + Log.i("$TAG There is [${list.size}] calls at this time") found.destroy() } } + updateOtherCallsInfo() + // Update currently displayed fragment according to call state if (call == core.currentCall || core.currentCall == null) { Log.i( @@ -116,6 +120,7 @@ class CallsViewModel @UiThread constructor() : ViewModel() { } } } + if (LinphoneUtils.isCallIncoming(call.state)) { Log.i("$TAG Asking activity to show incoming call fragment") showIncomingCallEvent.postValue(Event(true)) @@ -133,8 +138,6 @@ class CallsViewModel @UiThread constructor() : ViewModel() { } } } - - updateOtherCallsInfo() } } @@ -150,6 +153,7 @@ class CallsViewModel @UiThread constructor() : ViewModel() { } calls.postValue(list) callsCount.postValue(list.size) + Log.i("$TAG There is [${list.size}] calls") val currentCall = core.currentCall ?: core.calls.first() Log.i("$TAG Current call is [${currentCall.remoteAddress.asStringUriOnly()}]") @@ -194,6 +198,7 @@ class CallsViewModel @UiThread constructor() : ViewModel() { @WorkerThread private fun updateOtherCallsInfo() { val core = coreContext.core + if (core.callsNb > 1) { if (core.callsNb == 2) { val found = core.calls.find { @@ -217,8 +222,13 @@ class CallsViewModel @UiThread constructor() : ViewModel() { otherCallsStatus.postValue("") // TODO: improve ? } - Log.i("$TAG At least one other call, asking fragment to change status bar color") + Log.i("$TAG At least one other call, asking activity to change status bar color") changeSystemTopBarColorToMultipleCallsEvent.postValue(Event(true)) + } else { + Log.i( + "$TAG No more than one call, asking activity to change status bar color back to primary" + ) + changeSystemTopBarColorToMultipleCallsEvent.postValue(Event(false)) } } } diff --git a/app/src/main/res/layout/call_activity.xml b/app/src/main/res/layout/call_activity.xml index 71c5843e8..772c7ad6c 100644 --- a/app/src/main/res/layout/call_activity.xml +++ b/app/src/main/res/layout/call_activity.xml @@ -56,7 +56,7 @@ android:layout_marginStart="15dp" android:layout_marginEnd="15dp" app:layout_constraintWidth_max="@dimen/toast_max_width" - app:layout_constraintTop_toTopOf="parent" + app:layout_constraintTop_toBottomOf="@id/other_calls_top_bar" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" />