Apply changes from SDK regarding vCards API

This commit is contained in:
Sylvain Berfini 2020-10-22 15:25:09 +02:00
parent 4f667c7734
commit 9aea53345c
4 changed files with 20 additions and 20 deletions

View file

@ -99,7 +99,7 @@ class ContactEditorViewModel(val c: Contact?) : ViewModel(), ContactViewModelInt
} else { } else {
val friend = contact.friend ?: coreContext.core.createFriend() val friend = contact.friend ?: coreContext.core.createFriend()
friend.edit() friend.edit()
friend.setName("${firstName.value.orEmpty()} ${lastName.value.orEmpty()}") friend.name = "${firstName.value.orEmpty()} ${lastName.value.orEmpty()}"
for (address in friend.addresses) { for (address in friend.addresses) {
friend.removeAddress(address) friend.removeAddress(address)
@ -121,9 +121,9 @@ class ContactEditorViewModel(val c: Contact?) : ViewModel(), ContactViewModelInt
val vCard = friend.vcard val vCard = friend.vcard
if (vCard != null) { if (vCard != null) {
vCard.organization = organization.value.orEmpty() vCard.organization = organization.value
vCard.familyName = lastName.value.orEmpty() vCard.familyName = lastName.value
vCard.givenName = firstName.value.orEmpty() vCard.givenName = firstName.value
} }
friend.done() friend.done()

View file

@ -176,13 +176,13 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
if (friend != null) { if (friend != null) {
friend.edit() friend.edit()
val fn = fullName val fn = fullName
if (fn != null) friend.setName(fn) if (fn != null) friend.name = fn
val vCard = friend.vcard val vCard = friend.vcard
if (vCard != null) { if (vCard != null) {
vCard.familyName = lastName vCard.familyName = lastName
vCard.givenName = firstName vCard.givenName = firstName
if (organization != null) vCard.organization = organization vCard.organization = organization
} }
if (!created) { if (!created) {

View file

@ -54,10 +54,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@drawable/footer_button" android:background="@drawable/footer_button"
android:onClick="@{historyClickListener}"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guidelineTop" app:layout_constraintBottom_toTopOf="@id/guidelineTop"
app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count_land" app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count_land">
android:onClick="@{historyClickListener}">
<ImageView <ImageView
android:id="@+id/history" android:id="@+id/history"
@ -84,9 +84,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@drawable/footer_button" android:background="@drawable/footer_button"
android:onClick="@{contactsClickListener}"
app:layout_constraintTop_toTopOf="@id/guidelineTop" app:layout_constraintTop_toTopOf="@id/guidelineTop"
app:layout_constraintBottom_toTopOf="@id/guidelineMiddle" app:layout_constraintBottom_toTopOf="@id/guidelineMiddle">
android:onClick="@{contactsClickListener}">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -102,9 +102,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@drawable/footer_button" android:background="@drawable/footer_button"
android:onClick="@{dialerClickListener}"
app:layout_constraintTop_toTopOf="@id/guidelineMiddle" app:layout_constraintTop_toTopOf="@id/guidelineMiddle"
app:layout_constraintBottom_toTopOf="@id/guidelineBottom" app:layout_constraintBottom_toTopOf="@id/guidelineBottom">
android:onClick="@{dialerClickListener}">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -120,10 +120,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@drawable/footer_button" android:background="@drawable/footer_button"
android:onClick="@{chatClickListener}"
app:layout_constraintTop_toTopOf="@id/guidelineBottom" app:layout_constraintTop_toTopOf="@id/guidelineBottom"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layoutDescription="@xml/motion_main_activity_tabs_chat_unread_count_land" app:layoutDescription="@xml/motion_main_activity_tabs_chat_unread_count_land">
android:onClick="@{chatClickListener}">
<ImageView <ImageView
android:id="@+id/chat" android:id="@+id/chat"

View file

@ -51,11 +51,11 @@
<androidx.constraintlayout.motion.widget.MotionLayout <androidx.constraintlayout.motion.widget.MotionLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{historyClickListener}" android:onClick="@{historyClickListener}"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/guidelineLeft" app:layout_constraintEnd_toEndOf="@id/guidelineLeft"
app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count" app:layoutDescription="@xml/motion_main_activity_tabs_history_unread_count">
android:background="@drawable/footer_button">
<ImageView <ImageView
android:id="@+id/history" android:id="@+id/history"
@ -82,10 +82,10 @@
<RelativeLayout <RelativeLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{contactsClickListener}" android:onClick="@{contactsClickListener}"
app:layout_constraintStart_toStartOf="@id/guidelineLeft" app:layout_constraintStart_toStartOf="@id/guidelineLeft"
app:layout_constraintEnd_toEndOf="@id/guidelineMiddle" app:layout_constraintEnd_toEndOf="@id/guidelineMiddle">
android:background="@drawable/footer_button">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -100,10 +100,10 @@
<RelativeLayout <RelativeLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/footer_button"
android:onClick="@{dialerClickListener}" android:onClick="@{dialerClickListener}"
app:layout_constraintStart_toStartOf="@id/guidelineMiddle" app:layout_constraintStart_toStartOf="@id/guidelineMiddle"
app:layout_constraintEnd_toEndOf="@id/guidelineRight" app:layout_constraintEnd_toEndOf="@id/guidelineRight">
android:background="@drawable/footer_button">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"