Fixed account profile avatar not being updated when set/removed + started chat event display

This commit is contained in:
Sylvain Berfini 2023-10-16 11:33:28 +02:00
parent ae1e2599a8
commit c076dcb2c7
4 changed files with 33 additions and 7 deletions

View file

@ -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
}

View file

@ -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()
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">
<stroke android:width="1dp" android:color="@color/gray_main2_200"/>
<size android:height="1dp" android:width="50dp" />
</shape>

View file

@ -10,15 +10,30 @@
type="org.linphone.ui.main.chat.model.EventModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp">
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">
<!-- Ugly hack to prevent last character to be missing half of it, don't know why yet -->
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:text="@{model.text + ` `, default=`You have left the group`}"
android:textColor="@color/gray_main2_500"
android:textSize="12sp"
android:textStyle="italic" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</layout>