Hide size setting if auto download policy is never or always + finished friend edition
This commit is contained in:
parent
1f3321967f
commit
bf024abdb9
2 changed files with 27 additions and 2 deletions
|
@ -99,7 +99,31 @@ class ContactEditorViewModel(val c: Contact?) : ViewModel(), ContactViewModelInt
|
||||||
val friend = contact.friend ?: coreContext.core.createFriend()
|
val friend = contact.friend ?: coreContext.core.createFriend()
|
||||||
if (friend != null) {
|
if (friend != null) {
|
||||||
friend.edit()
|
friend.edit()
|
||||||
// TODO edit friend
|
friend.name = "${firstName.value.orEmpty()} ${lastName.value.orEmpty()}"
|
||||||
|
|
||||||
|
for (address in friend.addresses) {
|
||||||
|
friend.removeAddress(address)
|
||||||
|
}
|
||||||
|
for (address in addresses.value.orEmpty()) {
|
||||||
|
val parsed = coreContext.core.interpretUrl(address.newValue.value.orEmpty())
|
||||||
|
if (parsed != null) friend.addAddress(parsed)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (phone in friend.phoneNumbers) {
|
||||||
|
friend.removePhoneNumber(phone)
|
||||||
|
}
|
||||||
|
for (phone in numbers.value.orEmpty()) {
|
||||||
|
if (phone.newValue.value?.isNotEmpty() == true) {
|
||||||
|
friend.addPhoneNumber(phone.newValue.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val vCard = friend.vcard
|
||||||
|
if (vCard != null) {
|
||||||
|
vCard.organization = organization.value.orEmpty()
|
||||||
|
vCard.familyName = lastName.value.orEmpty()
|
||||||
|
vCard.givenName = firstName.value.orEmpty()
|
||||||
|
}
|
||||||
friend.done()
|
friend.done()
|
||||||
|
|
||||||
if (contact.friend == null) {
|
if (contact.friend == null) {
|
||||||
|
|
|
@ -88,7 +88,8 @@
|
||||||
linphone:listener="@{viewModel.autoDownloadMaxSizeListener}"
|
linphone:listener="@{viewModel.autoDownloadMaxSizeListener}"
|
||||||
linphone:defaultValue="@{viewModel.autoDownloadMaxSize.toString()}"
|
linphone:defaultValue="@{viewModel.autoDownloadMaxSize.toString()}"
|
||||||
linphone:inputType="@{InputType.TYPE_CLASS_NUMBER}"
|
linphone:inputType="@{InputType.TYPE_CLASS_NUMBER}"
|
||||||
linphone:enabled="@{viewModel.autoDownloadIndex == 2}"/>
|
linphone:enabled="@{viewModel.autoDownloadIndex == 2}"
|
||||||
|
android:visibility="@{viewModel.autoDownloadIndex == 2 ? View.VISIBLE : View.GONE}"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_switch"
|
layout="@layout/settings_widget_switch"
|
||||||
|
|
Loading…
Reference in a new issue