mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed in-call top bar displaying other calls
This commit is contained in:
parent
c4fe71c59f
commit
5e50ef4045
3 changed files with 15 additions and 4 deletions
|
|
@ -97,6 +97,7 @@ class CallActivity : AppCompatActivity() {
|
|||
callsViewModel = run {
|
||||
ViewModelProvider(this)[CallsViewModel::class.java]
|
||||
}
|
||||
binding.callsViewModel = callsViewModel
|
||||
|
||||
callViewModel = run {
|
||||
ViewModelProvider(this)[CurrentCallViewModel::class.java]
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue