From c076dcb2c79cc00a38b4406a398c6319d330ea56 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 16 Oct 2023 11:33:28 +0200 Subject: [PATCH] Fixed account profile avatar not being updated when set/removed + started chat event display --- .../linphone/ui/main/chat/model/EventModel.kt | 4 ++- .../viewmodel/AccountProfileViewModel.kt | 6 ++++- .../res/drawable/shape_line_main2_200.xml | 5 ++++ app/src/main/res/layout/chat_event.xml | 25 +++++++++++++++---- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/drawable/shape_line_main2_200.xml diff --git a/app/src/main/java/org/linphone/ui/main/chat/model/EventModel.kt b/app/src/main/java/org/linphone/ui/main/chat/model/EventModel.kt index d24131afd..72be4b6bb 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/model/EventModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/model/EventModel.kt @@ -22,4 +22,6 @@ package org.linphone.ui.main.chat.model import androidx.annotation.WorkerThread import org.linphone.core.EventLog -class EventModel @WorkerThread constructor(eventLog: EventLog) +class EventModel @WorkerThread constructor(eventLog: EventLog) { + val text = eventLog.type.name // TODO FIXME: use proper translated string instead +} diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/AccountProfileViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/AccountProfileViewModel.kt index 92cb9a800..64f995c6b 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/AccountProfileViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/AccountProfileViewModel.kt @@ -170,7 +170,11 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() { copy.pictureUri = null } - accountModel.value?.images?.postValue(arrayListOf(path)) + // Create a new model to force UI to update + val newModel = AccountModel(account) + newModel.images.postValue(arrayListOf(path)) + accountModel.postValue(newModel) + account.params = copy account.refreshRegister() } diff --git a/app/src/main/res/drawable/shape_line_main2_200.xml b/app/src/main/res/drawable/shape_line_main2_200.xml new file mode 100644 index 000000000..532840742 --- /dev/null +++ b/app/src/main/res/drawable/shape_line_main2_200.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/chat_event.xml b/app/src/main/res/layout/chat_event.xml index f190bcaa4..9fbbf998e 100644 --- a/app/src/main/res/layout/chat_event.xml +++ b/app/src/main/res/layout/chat_event.xml @@ -10,15 +10,30 @@ type="org.linphone.ui.main.chat.model.EventModel" /> - + android:layout_marginBottom="5dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:background="@drawable/shape_line_main2_200" + android:gravity="center" + android:orientation="horizontal"> + + - - + \ No newline at end of file