From e572ecb6784df78f5109ef0c870f44fc84ba66f4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Apr 2018 11:04:34 +0200 Subject: [PATCH] fix #142, make address field multiline --- .../com/simplemobiletools/contacts/helpers/VcfExporter.kt | 2 +- .../com/simplemobiletools/contacts/helpers/VcfImporter.kt | 2 +- app/src/main/res/layout/item_edit_address.xml | 5 +---- app/src/main/res/layout/item_view_address.xml | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt index 91d817d8..88f077f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt @@ -55,7 +55,7 @@ class VcfExporter { contact.addresses.forEach { val type = getAddressTypeLabel(it.type) val delimiterType = if (type.isEmpty()) "" else ";$type" - out.writeLn("$ADR$delimiterType:;;${it.value};;;;") + out.writeLn("$ADR$delimiterType:;;${it.value.replace("\n", "\\n")};;;;") } contact.events.forEach { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt index f1c45102..85561636 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt @@ -187,7 +187,7 @@ class VcfImporter(val activity: SimpleActivity) { val type = getAddressTypeId(rawType.toUpperCase()) val addresses = addressParts[1].split(";") if (addresses.size == 7) { - curAddresses.add(Address(addresses[2], type)) + curAddresses.add(Address(addresses[2].replace("\\n", "\n"), type)) } } diff --git a/app/src/main/res/layout/item_edit_address.xml b/app/src/main/res/layout/item_edit_address.xml index f18e5552..36a6e910 100644 --- a/app/src/main/res/layout/item_edit_address.xml +++ b/app/src/main/res/layout/item_edit_address.xml @@ -13,10 +13,7 @@ android:layout_toLeftOf="@+id/contact_address_type" android:layout_toStartOf="@+id/contact_address_type" android:hint="@string/address" - android:inputType="textCapWords" - android:lines="1" - android:maxLines="1" - android:singleLine="true" + android:inputType="textCapWords|textMultiLine" android:textCursorDrawable="@null" android:textSize="@dimen/bigger_text_size"/> diff --git a/app/src/main/res/layout/item_view_address.xml b/app/src/main/res/layout/item_view_address.xml index fa3497b8..c3f46463 100644 --- a/app/src/main/res/layout/item_view_address.xml +++ b/app/src/main/res/layout/item_view_address.xml @@ -15,9 +15,6 @@ android:layout_centerVertical="true" android:layout_toLeftOf="@+id/contact_address_type" android:layout_toStartOf="@+id/contact_address_type" - android:lines="1" - android:maxLines="1" - android:singleLine="true" android:textSize="@dimen/bigger_text_size"/>