Fixed UI issue when pausing call
This commit is contained in:
parent
578b275b5b
commit
61d2fdbe10
3 changed files with 10 additions and 8 deletions
|
@ -30,6 +30,8 @@ import org.linphone.utils.PermissionHelper
|
||||||
class CallsViewModel : ViewModel() {
|
class CallsViewModel : ViewModel() {
|
||||||
val currentCallViewModel = MutableLiveData<CallViewModel>()
|
val currentCallViewModel = MutableLiveData<CallViewModel>()
|
||||||
|
|
||||||
|
val noActiveCall = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val callPausedByRemote = MutableLiveData<Boolean>()
|
val callPausedByRemote = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val pausedCalls = MutableLiveData<ArrayList<CallViewModel>>()
|
val pausedCalls = MutableLiveData<ArrayList<CallViewModel>>()
|
||||||
|
@ -52,6 +54,7 @@ class CallsViewModel : ViewModel() {
|
||||||
callPausedByRemote.value = (state == Call.State.PausedByRemote) and (call.conference == null)
|
callPausedByRemote.value = (state == Call.State.PausedByRemote) and (call.conference == null)
|
||||||
|
|
||||||
val currentCall = core.currentCall
|
val currentCall = core.currentCall
|
||||||
|
noActiveCall.value = currentCall == null
|
||||||
if (currentCall == null) {
|
if (currentCall == null) {
|
||||||
currentCallViewModel.value?.destroy()
|
currentCallViewModel.value?.destroy()
|
||||||
} else if (currentCallViewModel.value?.call != currentCall) {
|
} else if (currentCallViewModel.value?.call != currentCall) {
|
||||||
|
@ -88,6 +91,7 @@ class CallsViewModel : ViewModel() {
|
||||||
coreContext.core.addListener(listener)
|
coreContext.core.addListener(listener)
|
||||||
|
|
||||||
val currentCall = coreContext.core.currentCall
|
val currentCall = coreContext.core.currentCall
|
||||||
|
noActiveCall.value = currentCall == null
|
||||||
if (currentCall != null) {
|
if (currentCall != null) {
|
||||||
currentCallViewModel.value?.destroy()
|
currentCallViewModel.value?.destroy()
|
||||||
currentCallViewModel.value = CallViewModel(currentCall)
|
currentCallViewModel.value = CallViewModel(currentCall)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/active_call_header"
|
android:id="@+id/active_call_header"
|
||||||
android:visibility="@{viewModel.currentCallViewModel == null || conferenceViewModel.isInConference() ? View.GONE : View.VISIBLE}"
|
android:visibility="@{viewModel.noActiveCall || conferenceViewModel.isInConference() ? View.GONE : View.VISIBLE}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
app:conferenceViewModel="@{conferenceViewModel}" />
|
app:conferenceViewModel="@{conferenceViewModel}" />
|
||||||
|
|
||||||
<org.linphone.contact.BigContactAvatarView
|
<org.linphone.contact.BigContactAvatarView
|
||||||
android:visibility="@{controlsViewModel.isVideoEnabled || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE, default=gone}"
|
android:visibility="@{viewModel.noActiveCall || controlsViewModel.isVideoEnabled || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE, default=gone}"
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
|
@ -121,8 +121,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:onClick="@{() -> viewModel.currentCallViewModel.pause()}"
|
android:onClick="@{() -> viewModel.currentCallViewModel.pause()}"
|
||||||
android:visibility="@{viewModel.currentCallViewModel == null || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE}"
|
android:visibility="@{viewModel.noActiveCall || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE}"
|
||||||
android:selected="@{viewModel.currentCallViewModel.isPaused ?? false}"
|
|
||||||
android:enabled="@{!viewModel.callPausedByRemote && controlsViewModel.isPauseEnabled}"
|
android:enabled="@{!viewModel.callPausedByRemote && controlsViewModel.isPauseEnabled}"
|
||||||
android:contentDescription="@string/content_description_pause_call"
|
android:contentDescription="@string/content_description_pause_call"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/active_call_header"
|
android:id="@+id/active_call_header"
|
||||||
android:visibility="@{viewModel.currentCallViewModel == null || conferenceViewModel.isInConference() ? View.GONE : View.VISIBLE}"
|
android:visibility="@{viewModel.noActiveCall || conferenceViewModel.isInConference() ? View.GONE : View.VISIBLE}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
app:conferenceViewModel="@{conferenceViewModel}" />
|
app:conferenceViewModel="@{conferenceViewModel}" />
|
||||||
|
|
||||||
<org.linphone.contact.BigContactAvatarView
|
<org.linphone.contact.BigContactAvatarView
|
||||||
android:visibility="@{controlsViewModel.isVideoEnabled || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE, default=gone}"
|
android:visibility="@{viewModel.noActiveCall || controlsViewModel.isVideoEnabled || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE, default=gone}"
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
|
@ -121,8 +121,7 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:onClick="@{() -> viewModel.currentCallViewModel.pause()}"
|
android:onClick="@{() -> viewModel.currentCallViewModel.pause()}"
|
||||||
android:visibility="@{viewModel.currentCallViewModel == null || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE}"
|
android:visibility="@{viewModel.noActiveCall || conferenceViewModel.isInConference ? View.GONE : View.VISIBLE}"
|
||||||
android:selected="@{viewModel.currentCallViewModel.isPaused ?? false}"
|
|
||||||
android:enabled="@{!viewModel.callPausedByRemote && controlsViewModel.isPauseEnabled}"
|
android:enabled="@{!viewModel.callPausedByRemote && controlsViewModel.isPauseEnabled}"
|
||||||
android:contentDescription="@string/content_description_pause_call"
|
android:contentDescription="@string/content_description_pause_call"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
|
|
Loading…
Reference in a new issue