mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	handle contact website import/export
This commit is contained in:
		| @@ -46,6 +46,7 @@ const val ADR = "ADR" | ||||
| const val NOTE = "NOTE:" | ||||
| const val ORG = "ORG:" | ||||
| const val TITLE = "TITLE:" | ||||
| const val URL = "URL:" | ||||
| const val ENCODING = "ENCODING" | ||||
| const val BASE64 = "BASE64" | ||||
| const val JPEG = "JPEG" | ||||
|   | ||||
| @@ -71,6 +71,10 @@ class VcfExporter { | ||||
|                             out.writeLn("$TITLE${contact.organization.jobPosition.replace("\n", "\\n")}") | ||||
|                         } | ||||
|  | ||||
|                         contact.websites.forEach { | ||||
|                             out.writeLn("$URL$it") | ||||
|                         } | ||||
|  | ||||
|                         if (contact.thumbnailUri.isNotEmpty()) { | ||||
|                             val bitmap = MediaStore.Images.Media.getBitmap(activity.contentResolver, Uri.parse(contact.thumbnailUri)) | ||||
|                             addBitmap(bitmap, out) | ||||
|   | ||||
| @@ -91,6 +91,7 @@ class VcfImporter(val activity: SimpleActivity) { | ||||
|                         line.toUpperCase().startsWith(PHOTO) -> addPhoto(line.substring(PHOTO.length)) | ||||
|                         line.toUpperCase().startsWith(ORG) -> addCompany(line.substring(ORG.length)) | ||||
|                         line.toUpperCase().startsWith(TITLE) -> addJobPosition(line.substring(TITLE.length)) | ||||
|                         line.toUpperCase().startsWith(URL) -> addWebsite(line.substring(URL.length)) | ||||
|                         line.toUpperCase() == END_VCARD -> saveContact(targetContactSource) | ||||
|                         isGettingPhoto -> currentPhotoString.append(line.trim()) | ||||
|                     } | ||||
| @@ -251,6 +252,10 @@ class VcfImporter(val activity: SimpleActivity) { | ||||
|         curJobPosition = jobPosition | ||||
|     } | ||||
|  | ||||
|     private fun addWebsite(website: String) { | ||||
|         curWebsites.add(website) | ||||
|     } | ||||
|  | ||||
|     private fun saveContact(source: String) { | ||||
|         val organization = Organization(curCompany, curJobPosition) | ||||
|         val contact = Contact(0, curPrefix, curFirstName, curMiddleName, curSurname, curSuffix, curPhotoUri, curPhoneNumbers, curEmails, curAddresses, curEvents, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user